| java.lang.Object org.jgroups.blocks.PullPushAdapter
PullPushAdapter | public class PullPushAdapter implements Runnable,ChannelListener(Code) | | Allows a client of
org.jgroups.Channel to be notified when messages have been received
instead of having to actively poll the channel for new messages. Typically used in the
client role (receive()). As this class does not implement interface
org.jgroups.Transport , but uses it for receiving messages, an underlying object
has to be used to send messages (e.g. the channel on which an object of this class relies).
Multiple MembershipListeners can register with the PullPushAdapter; when a view is received, they
will all be notified. There is one main message listener which sends and receives message. In addition,
MessageListeners can register with a certain tag (identifier), and then send messages tagged with this
identifier. When a message with such an identifier is received, the corresponding MessageListener will be
looked up and the message dispatched to it. If no tag is found (default), the main MessageListener will
receive the message.
author: Bela Ban version: $Revision |
Inner Class :final public static class PullHeader extends Header | |
log | final protected Log log(Code) | | |
membership_listeners | final protected List membership_listeners(Code) | | |
channelConnected | public void channelConnected(Channel channel)(Code) | | |
channelDisconnected | public void channelDisconnected(Channel channel)(Code) | | |
channelReconnected | public void channelReconnected(Address addr)(Code) | | |
channelShunned | public void channelShunned()(Code) | | |
handleMessage | protected void handleMessage(Message msg)(Code) | | Check whether the message has an identifier. If yes, lookup the MessageListener associated with the
given identifier in the hashtable and dispatch to it. Otherwise just use the main (default) message
listener
|
notifyBlock | protected void notifyBlock()(Code) | | |
notifySuspect | protected void notifySuspect(Address suspected_mbr)(Code) | | |
notifyUnblock | protected void notifyUnblock()(Code) | | |
notifyViewChange | protected void notifyViewChange(View v)(Code) | | |
registerListener | public void registerListener(Serializable identifier, MessageListener l)(Code) | | Sets a listener to messages with a given identifier.
Messages sent with this identifier in their headers will be routed to this listener.
Note: there can be only one listener for one identifier;
if you want to register a different listener to an already registered identifier, then unregister first.
Parameters: identifier - - messages sent on the group with this object will be received by this listener Parameters: l - - the listener that will get the message |
run | public void run()(Code) | | Reentrant run(): message reception is serialized, then the listener is notified of the
message reception
|
send | public void send(Message msg) throws Exception(Code) | | Sends a message with no identifier; listener member will get this message on the other group members.
Parameters: msg - the Message to be sent throws: Exception - |
start | final public void start()(Code) | | |
unregisterListener | public void unregisterListener(Serializable identifier)(Code) | | Removes a message listener to a given identifier from the message listeners map.
Parameters: identifier - - the key to whom we do not want to listen any more |
|
|