Package org.atmosphere.plugin.jgroups
Class JGroupsFilter
- java.lang.Object
-
- org.atmosphere.plugin.jgroups.JGroupsFilter
-
- All Implemented Interfaces:
org.atmosphere.cpr.BroadcastFilter,org.atmosphere.cpr.BroadcastFilterLifecycle,org.atmosphere.cpr.ClusterBroadcastFilter
public class JGroupsFilter extends java.lang.Object implements org.atmosphere.cpr.ClusterBroadcastFilterThis is attached to a Broadcaster you want to have in a clustered situation. Each clustered broadcaster should have its own instance of a JGroupsFilter and likewise, each JGroupsFilter should have a circular reference back to that broadcaster. Therefore, when the JGroupsFilter is added to the Broadcaster config, remember to make the reference circular by calling JGroupsFilter.setBroadcaster(bc) or simply using the constructor with the Broadcaster to begin with. Uri is not currently used because the 'cluster name' is driven from the JGroupsChannel itself. I suppose it could be used to 'look up' the JGroupsChannel if there is a registry of them implemented somehow, but its easier to just inject the JGroupsChannel into the filter.- Author:
- Jean-Francois Arcand (original version), westraj
-
-
Constructor Summary
Constructors Constructor Description JGroupsFilter()JGroupsFilter(java.lang.String jGroupsFilterLocation)JGroupsFilter(JGroupsChannel jchannel)ConstructorJGroupsFilter(JGroupsChannel jchannel, org.atmosphere.cpr.Broadcaster bc)Constructor with broadcaster
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()org.atmosphere.cpr.BroadcastFilter.BroadcastActionfilter(java.lang.String broadcasterId, java.lang.Object originalMessage, java.lang.Object message)Every time a message gets broadcasted, make sure we update the cluster.org.atmosphere.cpr.BroadcastergetBroadcaster()voidinit(org.atmosphere.cpr.AtmosphereConfig config)voidsetBroadcaster(org.atmosphere.cpr.Broadcaster bc)voidsetUri(java.lang.String clusterUri)
-
-
-
Constructor Detail
-
JGroupsFilter
public JGroupsFilter()
-
JGroupsFilter
public JGroupsFilter(java.lang.String jGroupsFilterLocation)
-
JGroupsFilter
public JGroupsFilter(JGroupsChannel jchannel)
Constructor- Parameters:
jchannel-
-
JGroupsFilter
public JGroupsFilter(JGroupsChannel jchannel, org.atmosphere.cpr.Broadcaster bc)
Constructor with broadcaster- Parameters:
jchannel-bc-
-
-
Method Detail
-
destroy
public void destroy()
- Specified by:
destroyin interfaceorg.atmosphere.cpr.BroadcastFilterLifecycle
-
init
public void init(org.atmosphere.cpr.AtmosphereConfig config)
- Specified by:
initin interfaceorg.atmosphere.cpr.BroadcastFilterLifecycle
-
filter
public org.atmosphere.cpr.BroadcastFilter.BroadcastAction filter(java.lang.String broadcasterId, java.lang.Object originalMessage, java.lang.Object message)Every time a message gets broadcasted, make sure we update the cluster.- Specified by:
filterin interfaceorg.atmosphere.cpr.BroadcastFilter- Parameters:
message- the message to broadcast.- Returns:
- The same message.
-
getBroadcaster
public org.atmosphere.cpr.Broadcaster getBroadcaster()
- Specified by:
getBroadcasterin interfaceorg.atmosphere.cpr.ClusterBroadcastFilter
-
setBroadcaster
public void setBroadcaster(org.atmosphere.cpr.Broadcaster bc)
- Specified by:
setBroadcasterin interfaceorg.atmosphere.cpr.ClusterBroadcastFilter
-
setUri
public void setUri(java.lang.String clusterUri)
- Specified by:
setUriin interfaceorg.atmosphere.cpr.ClusterBroadcastFilter
-
-