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 Object
- implements org.atmosphere.cpr.ClusterBroadcastFilter
This 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
| Nested classes/interfaces inherited from interface org.atmosphere.cpr.BroadcastFilter |
org.atmosphere.cpr.BroadcastFilter.BroadcastAction |
| Fields inherited from interface org.atmosphere.cpr.BroadcastFilter |
VOID_ATMOSPHERE_RESOURCE_UUID |
|
Method Summary |
void |
destroy()
|
org.atmosphere.cpr.BroadcastFilter.BroadcastAction |
filter(Object originalMessage,
Object message)
Every time a message gets broadcasted, make sure we update the cluster. |
org.atmosphere.cpr.Broadcaster |
getBroadcaster()
|
void |
init(org.atmosphere.cpr.AtmosphereConfig config)
|
void |
setBroadcaster(org.atmosphere.cpr.Broadcaster bc)
|
void |
setUri(String clusterUri)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JGroupsFilter
public JGroupsFilter()
JGroupsFilter
public JGroupsFilter(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 -
destroy
public void destroy()
- Specified by:
destroy in interface org.atmosphere.cpr.BroadcastFilterLifecycle
init
public void init(org.atmosphere.cpr.AtmosphereConfig config)
- Specified by:
init in interface org.atmosphere.cpr.BroadcastFilterLifecycle
filter
public org.atmosphere.cpr.BroadcastFilter.BroadcastAction filter(Object originalMessage,
Object message)
- Every time a message gets broadcasted, make sure we update the cluster.
- Specified by:
filter in interface org.atmosphere.cpr.BroadcastFilter
- Parameters:
message - the message to broadcast.
- Returns:
- The same message.
getBroadcaster
public org.atmosphere.cpr.Broadcaster getBroadcaster()
- Specified by:
getBroadcaster in interface org.atmosphere.cpr.ClusterBroadcastFilter
setBroadcaster
public void setBroadcaster(org.atmosphere.cpr.Broadcaster bc)
- Specified by:
setBroadcaster in interface org.atmosphere.cpr.ClusterBroadcastFilter
setUri
public void setUri(String clusterUri)
- Specified by:
setUri in interface org.atmosphere.cpr.ClusterBroadcastFilter
Copyright © 2013. All Rights Reserved.