public class JGroupsChannelImpl extends org.jgroups.ReceiverAdapter implements JGroupsChannel
Best practice would have only 1 of these per Atmosphere application. Each JGroupsFilter instance has a reference to the singleton JGroupsChannel object and registers its broadcaster via the addBroadcaster() method.
| Constructor and Description |
|---|
JGroupsChannelImpl(org.jgroups.JChannel jChannel,
String clusterName)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBroadcaster(org.atmosphere.cpr.Broadcaster broadcaster)
Adds/replaces the broadcaster to the JGroupsChannel
|
void |
destroy()
Shutdown the cluster.
|
void |
init()
Connect to the cluster
|
void |
receive(org.jgroups.Message jgroupMessage) |
void |
removeBroadcaster(org.atmosphere.cpr.Broadcaster broadcaster)
Removes the broadcaster from the JGroupsChannel
|
void |
send(String topic,
Object message)
Called from a ClusterBroadcastFilter filter() method
to send the message over to other Atmosphere cluster nodes
|
public JGroupsChannelImpl(org.jgroups.JChannel jChannel,
String clusterName)
jChannel - unconnected JGroups JChannel objectclusterName - name of the group to connect the JChannel topublic void init()
throws Exception
Exception - if an exception happen during initializationpublic void destroy()
public void receive(org.jgroups.Message jgroupMessage)
receive in interface org.jgroups.MessageListenerreceive in class org.jgroups.ReceiverAdapterpublic void send(String topic, Object message)
send in interface JGroupsChanneltopic - the channel topicmessage - the message to sendpublic void addBroadcaster(org.atmosphere.cpr.Broadcaster broadcaster)
broadcaster - add this broadcaster to the channelpublic void removeBroadcaster(org.atmosphere.cpr.Broadcaster broadcaster)
broadcaster - remove this broadcaster from the channelCopyright © 2004–2021 Jahia Solutions Group SA. All rights reserved.