Package org.jgroups.blocks
Class PullPushAdapter
- java.lang.Object
-
- org.jgroups.blocks.PullPushAdapter
-
- All Implemented Interfaces:
java.lang.Runnable
,ChannelListener
public class PullPushAdapter extends java.lang.Object implements java.lang.Runnable, ChannelListener
Deprecated.UseReceiver
instead, this class will be removed in JGroups 3.0Allows a client ofChannel
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 interfaceTransport
, 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.
- Version:
- $Revision
- Author:
- Bela Ban
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PullPushAdapter.PullHeader
Deprecated.
-
Field Summary
Fields Modifier and Type Field Description protected MessageListener
listener
Deprecated.protected java.util.HashMap
listeners
Deprecated.protected org.apache.commons.logging.Log
log
Deprecated.protected java.util.List
membership_listeners
Deprecated.protected java.lang.Thread
receiver_thread
Deprecated.protected Transport
transport
Deprecated.
-
Constructor Summary
Constructors Constructor Description PullPushAdapter(Transport transport)
Deprecated.PullPushAdapter(Transport transport, MembershipListener ml)
Deprecated.PullPushAdapter(Transport transport, MessageListener l)
Deprecated.PullPushAdapter(Transport transport, MessageListener l, MembershipListener ml)
Deprecated.PullPushAdapter(Transport transport, MessageListener l, MembershipListener ml, boolean start)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addMembershipListener(MembershipListener l)
Deprecated.void
channelClosed(Channel channel)
Deprecated.void
channelConnected(Channel channel)
Deprecated.void
channelDisconnected(Channel channel)
Deprecated.void
channelReconnected(Address addr)
Deprecated.void
channelShunned()
Deprecated.MessageListener
getListener()
Deprecated.Transport
getTransport()
Deprecated.protected void
handleMessage(Message msg)
Deprecated.Check whether the message has an identifier.protected void
notifyBlock()
Deprecated.protected void
notifySuspect(Address suspected_mbr)
Deprecated.protected void
notifyUnblock()
Deprecated.protected void
notifyViewChange(View v)
Deprecated.void
registerListener(java.io.Serializable identifier, MessageListener l)
Deprecated.Sets a listener to messages with a given identifier.void
removeMembershipListener(MembershipListener l)
Deprecated.void
run()
Deprecated.Reentrant run(): message reception is serialized, then the listener is notified of the message receptionvoid
send(java.io.Serializable identifier, Message msg)
Deprecated.Sends a message to the group - listeners to this identifier will receive the messages.void
send(Message msg)
Deprecated.Sends a message with no identifier; listener member will get this message on the other group members.void
setListener(MessageListener l)
Deprecated.void
setMembershipListener(MembershipListener ml)
Deprecated.void
start()
Deprecated.void
stop()
Deprecated.void
unregisterListener(java.io.Serializable identifier)
Deprecated.Removes a message listener to a given identifier from the message listeners map.
-
-
-
Field Detail
-
transport
protected Transport transport
Deprecated.
-
listener
protected MessageListener listener
Deprecated.
-
membership_listeners
protected final java.util.List membership_listeners
Deprecated.
-
receiver_thread
protected java.lang.Thread receiver_thread
Deprecated.
-
listeners
protected final java.util.HashMap listeners
Deprecated.
-
log
protected final org.apache.commons.logging.Log log
Deprecated.
-
-
Constructor Detail
-
PullPushAdapter
public PullPushAdapter(Transport transport)
Deprecated.
-
PullPushAdapter
public PullPushAdapter(Transport transport, MessageListener l)
Deprecated.
-
PullPushAdapter
public PullPushAdapter(Transport transport, MembershipListener ml)
Deprecated.
-
PullPushAdapter
public PullPushAdapter(Transport transport, MessageListener l, MembershipListener ml)
Deprecated.
-
PullPushAdapter
public PullPushAdapter(Transport transport, MessageListener l, MembershipListener ml, boolean start)
Deprecated.
-
-
Method Detail
-
getTransport
public Transport getTransport()
Deprecated.
-
start
public final void start()
Deprecated.
-
stop
public void stop()
Deprecated.
-
send
public void send(java.io.Serializable identifier, Message msg) throws java.lang.Exception
Deprecated.Sends a message to the group - listeners to this identifier will receive the messages.- Parameters:
identifier
- the key that the proper listeners are listenting onmsg
- the Message to be sent- Throws:
java.lang.Exception
- See Also:
registerListener(java.io.Serializable, org.jgroups.MessageListener)
-
send
public void send(Message msg) throws java.lang.Exception
Deprecated.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:
java.lang.Exception
-
setListener
public final void setListener(MessageListener l)
Deprecated.
-
registerListener
public void registerListener(java.io.Serializable identifier, MessageListener l)
Deprecated.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 listenerl
- - the listener that will get the message
-
unregisterListener
public void unregisterListener(java.io.Serializable identifier)
Deprecated.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
-
setMembershipListener
public void setMembershipListener(MembershipListener ml)
Deprecated.
-
addMembershipListener
public final void addMembershipListener(MembershipListener l)
Deprecated.
-
removeMembershipListener
public void removeMembershipListener(MembershipListener l)
Deprecated.
-
run
public void run()
Deprecated.Reentrant run(): message reception is serialized, then the listener is notified of the message reception- Specified by:
run
in interfacejava.lang.Runnable
-
handleMessage
protected void handleMessage(Message msg)
Deprecated.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
-
notifyViewChange
protected void notifyViewChange(View v)
Deprecated.
-
notifySuspect
protected void notifySuspect(Address suspected_mbr)
Deprecated.
-
notifyBlock
protected void notifyBlock()
Deprecated.
-
notifyUnblock
protected void notifyUnblock()
Deprecated.
-
channelConnected
public void channelConnected(Channel channel)
Deprecated.- Specified by:
channelConnected
in interfaceChannelListener
-
channelDisconnected
public void channelDisconnected(Channel channel)
Deprecated.- Specified by:
channelDisconnected
in interfaceChannelListener
-
channelClosed
public void channelClosed(Channel channel)
Deprecated.- Specified by:
channelClosed
in interfaceChannelListener
-
channelShunned
public void channelShunned()
Deprecated.- Specified by:
channelShunned
in interfaceChannelListener
-
channelReconnected
public void channelReconnected(Address addr)
Deprecated.- Specified by:
channelReconnected
in interfaceChannelListener
-
getListener
public MessageListener getListener()
Deprecated.- Returns:
- Returns the listener.
-
-