org.atmosphere.plugin.jgroups
Class JGroupsFilter
java.lang.Object
org.atmosphere.plugin.jgroups.JGroupsFilter
- All Implemented Interfaces:
- BroadcastFilter, BroadcastFilterLifecycle, ClusterBroadcastFilter
public class JGroupsFilter
- extends Object
- implements 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
| 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,
Broadcaster bc)
- Constructor with broadcaster
- Parameters:
jchannel - bc -
destroy
public void destroy()
- Specified by:
destroy in interface BroadcastFilterLifecycle
init
public void init()
- Specified by:
init in interface BroadcastFilterLifecycle
filter
public BroadcastFilter.BroadcastAction filter(Object originalMessage,
Object message)
- Every time a message gets broadcasted, make sure we update the cluster.
- Specified by:
filter in interface BroadcastFilter
- Parameters:
message - the message to broadcast.
- Returns:
- The same message.
getBroadcaster
public Broadcaster getBroadcaster()
- Specified by:
getBroadcaster in interface ClusterBroadcastFilter
setBroadcaster
public void setBroadcaster(Broadcaster bc)
- Specified by:
setBroadcaster in interface ClusterBroadcastFilter
setUri
public void setUri(String clusterUri)
- Specified by:
setUri in interface ClusterBroadcastFilter
Copyright © 2012. All Rights Reserved.