com.opensymphony.oscache.plugins.clustersupport
Class JMSBroadcastingListener

java.lang.Object
  extended by com.opensymphony.oscache.plugins.clustersupport.AbstractBroadcastingListener
      extended by 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

Field Summary
private  String clusterNode
          The name of this cluster.
private  javax.jms.Connection connection
          The JMS connection used
private static org.apache.commons.logging.Log log
           
private  javax.jms.MessageProducer messagePublisher
          Th object used to publish new messages
private  javax.jms.Session publisherSession
          The current JMS session
 
Fields inherited from class com.opensymphony.oscache.plugins.clustersupport.AbstractBroadcastingListener
cache, CLUSTER_ORIGIN
 
Constructor Summary
JMSBroadcastingListener()
           
 
Method Summary
 void finialize()
          Called by the cache administrator class when a cache is destroyed.
protected  InitialContext getInitialContext()
           
 void initialize(Cache cache, Config config)
          Called by the cache administrator class when a cache is instantiated.
protected  void sendNotification(ClusterNotification message)
          Called when a cluster notification message is to be broadcast.
 
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
 

Field Detail

log

private static final org.apache.commons.logging.Log log

connection

private javax.jms.Connection connection
The JMS connection used


messagePublisher

private javax.jms.MessageProducer messagePublisher
Th object used to publish new messages


publisherSession

private javax.jms.Session publisherSession
The current JMS session


clusterNode

private String clusterNode
The name of this cluster. Used to identify the sender of a message.

Constructor Detail

JMSBroadcastingListener

public JMSBroadcastingListener()
Method Detail

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:


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


Copyright © 2011 OpenSymphony. All Rights Reserved.