Receiver
instead, this class will be removed in JGroups 3.0public class PullPushAdapter extends ChannelListenerAdapter implements Runnable
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
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.
Modifier and Type | Class and Description |
---|---|
static class |
PullPushAdapter.PullHeader
Deprecated.
|
Modifier and Type | Field and Description |
---|---|
protected MessageListener |
listener
Deprecated.
|
protected HashMap |
listeners
Deprecated.
|
protected Log |
log
Deprecated.
|
protected List |
membership_listeners
Deprecated.
|
protected Thread |
receiver_thread
Deprecated.
|
protected Transport |
transport
Deprecated.
|
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
void |
addMembershipListener(MembershipListener l)
Deprecated.
|
void |
channelClosed(Channel channel)
Deprecated.
|
void |
channelConnected(Channel channel)
Deprecated.
|
void |
channelDisconnected(Channel channel)
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(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 reception
|
void |
send(Message msg)
Deprecated.
Sends a message with no identifier; listener member will get this message on the other group members.
|
void |
send(Serializable identifier,
Message msg)
Deprecated.
Sends a message to the group - listeners to this identifier will receive the messages.
|
void |
setListener(MessageListener l)
Deprecated.
|
void |
setMembershipListener(MembershipListener ml)
Deprecated.
|
void |
start()
Deprecated.
|
void |
stop()
Deprecated.
|
void |
unregisterListener(Serializable identifier)
Deprecated.
Removes a message listener to a given identifier from the message listeners map.
|
channelReconnected, channelShunned
protected Transport transport
protected MessageListener listener
protected final List membership_listeners
protected Thread receiver_thread
protected final HashMap listeners
protected final Log log
public PullPushAdapter(Transport transport)
public PullPushAdapter(Transport transport, MessageListener l)
public PullPushAdapter(Transport transport, MembershipListener ml)
public PullPushAdapter(Transport transport, MessageListener l, MembershipListener ml)
public PullPushAdapter(Transport transport, MessageListener l, MembershipListener ml, boolean start)
public Transport getTransport()
public final void start()
public void stop()
public void send(Serializable identifier, Message msg) throws Exception
identifier
- the key that the proper listeners are listenting onmsg
- the Message to be sentException
registerListener(java.io.Serializable, org.jgroups.MessageListener)
public void send(Message msg) throws Exception
msg
- the Message to be sentException
public final void setListener(MessageListener l)
public void registerListener(Serializable identifier, MessageListener l)
identifier
- - messages sent on the group with this object will be received by this listenerl
- - the listener that will get the messagepublic void unregisterListener(Serializable identifier)
identifier
- - the key to whom we do not want to listen any morepublic void setMembershipListener(MembershipListener ml)
addMembershipListener(org.jgroups.MembershipListener)
public final void addMembershipListener(MembershipListener l)
public void removeMembershipListener(MembershipListener l)
public void run()
protected void handleMessage(Message msg)
protected void notifyViewChange(View v)
protected void notifySuspect(Address suspected_mbr)
protected void notifyBlock()
protected void notifyUnblock()
public void channelConnected(Channel channel)
channelConnected
in interface ChannelListener
channelConnected
in class ChannelListenerAdapter
public void channelDisconnected(Channel channel)
channelDisconnected
in interface ChannelListener
channelDisconnected
in class ChannelListenerAdapter
public void channelClosed(Channel channel)
channelClosed
in interface ChannelListener
channelClosed
in class ChannelListenerAdapter
public MessageListener getListener()
Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.