com.opensymphony.oscache.plugins.clustersupport
Class JMSBroadcastingListener
java.lang.Object
com.opensymphony.oscache.plugins.clustersupport.AbstractBroadcastingListener
com.opensymphony.oscache.plugins.clustersupport.JMSBroadcastingListener
- All Implemented Interfaces:
- CacheEntryEventListener, CacheEventListener, LifecycleAware, EventListener
public class JMSBroadcastingListener
- extends AbstractBroadcastingListener
A JMS based clustering implementation. This implementation is independent of the
JMS provider and uses non-persistent messages on a publish subscribe protocol.
- Author:
- Romulus Pasca
Methods inherited from class com.opensymphony.oscache.plugins.clustersupport.AbstractBroadcastingListener |
cacheEntryAdded, cacheEntryFlushed, cacheEntryRemoved, cacheEntryUpdated, cacheFlushed, cacheGroupAdded, cacheGroupEntryAdded, cacheGroupEntryRemoved, cacheGroupFlushed, cacheGroupRemoved, cacheGroupUpdated, cachePatternFlushed, handleClusterNotification |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JMSBroadcastingListener
public JMSBroadcastingListener()
initialize
public void initialize(Cache cache,
Config config)
throws InitializationException
Called by the cache administrator class when a cache is instantiated.
The JMS broadcasting implementation requires the following configuration
properties to be specified in oscache.properties
:
- cache.cluster.jms.topic.factory - The JMS connection factory to use
- cache.cluster.jms.topic.name - The JMS topic name
- cache.cluster.jms.node.name - The name of this node in the cluster. This
should be unique for each node.
Please refer to the clustering documentation for further details on configuring
the JMS clustered caching.
- Specified by:
initialize
in interface LifecycleAware
- Overrides:
initialize
in class AbstractBroadcastingListener
- Parameters:
cache
- the cache instance that this listener is attached to.config
- The cache's configuration details. This allows the event handler
to initialize itself based on the cache settings, and also to receive additional
settings that were part of the cache configuration but that the cache
itself does not care about. If you are using cache.properties
for your configuration, simply add any additional properties that your event
handler requires and they will be passed through in this parameter.
- Throws:
InitializationException
- thrown when there was a
problem initializing the listener. The cache administrator will log this error and
disable the listener.
finialize
public void finialize()
throws FinalizationException
- Called by the cache administrator class when a cache is destroyed.
- Throws:
FinalizationException
- thrown when there was a problem finalizing the
listener. The cache administrator will catch and log this error.
sendNotification
protected void sendNotification(ClusterNotification message)
- Description copied from class:
AbstractBroadcastingListener
- Called when a cluster notification message is to be broadcast. Implementing
classes should use their underlying transport to broadcast the message across
the cluster.
- Specified by:
sendNotification
in class AbstractBroadcastingListener
- Parameters:
message
- The notification message to broadcast.
getInitialContext
protected InitialContext getInitialContext()
throws NamingException
- Returns:
- creates a context for performing naming operations.
- Throws:
NamingException
- if a naming exception is encountered