All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.externals.jgroups.IMessageDispatcher Maven / Gradle / Ivy

There is a newer version: 1.0.36
Show newest version
/**
 * EasyBeans
 * Copyright (C) 2008 Bull S.A.S.
 * Contact: [email protected]
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id: IMessageDispatcher.java 2486 2008-02-20 18:10:03Z loris $
 * --------------------------------------------------------------------------
 */

package org.ow2.externals.jgroups;

import java.util.Vector;

import org.jgroups.Channel;
import org.jgroups.Message;
import org.jgroups.SuspectedException;
import org.jgroups.TimeoutException;
import org.jgroups.util.RspList;

/**
 * Interface of a message dispatcher.
 * @author Loris Bouzonnet
 */
public interface IMessageDispatcher {

    /**
     * Cast a message to all members, and wait for mode responses. The responses are returned in a response
     * list, where each response is associated with its sender.

Uses GroupRequest. * * @param dests The members to which the message is to be sent. If it is null, then the message is sent to all * members * @param msg The message to be sent to n members * @param mode Defined in GroupRequest. The number of responses to wait for:

  1. GET_FIRST: * return the first response received.
  2. GET_ALL: wait for all responses (minus the ones from * suspected members)
  3. GET_MAJORITY: wait for a majority of all responses (relative to the grp * size)
  4. GET_ABS_MAJORITY: wait for majority (absolute, computed once)
  5. GET_N: wait for n * responses (may block if n > group size)
  6. GET_NONE: wait for no responses, return immediately * (non-blocking)
* @param timeout If 0: wait forever. Otherwise, wait for mode responses or timeout time. * @return RspList A list of responses. Each response is an Object and associated to its sender. */ RspList castMessage(final Vector dests, Message msg, int mode, long timeout); /** * Sends a message to a single member (destination = msg.dest) and returns the response. The message's destination * must be non-zero ! */ Object sendMessage(Message msg, int mode, long timeout) throws TimeoutException, SuspectedException; /** * Offers access to the underlying Channel. * @return a reference to the underlying Channel. */ Channel getChannel(); void stop(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy