站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 server API Documentation 英文版文档

JMSCacheInvalidationBridge (JBoss Server API) - JBoss 4.0.1 sp1 server API Documentation 英文版文档


org.jboss.cache.invalidation.bridges
Class JMSCacheInvalidationBridge

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.cache.invalidation.bridges.JMSCacheInvalidationBridge
All Implemented Interfaces:
InvalidationBridgeListener, JMSCacheInvalidationBridgeMBean, javax.management.MBeanRegistration, javax.jms.MessageListener, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class JMSCacheInvalidationBridge
extends org.jboss.system.ServiceMBeanSupport
implements JMSCacheInvalidationBridgeMBean, InvalidationBridgeListener, javax.jms.MessageListener

JMS implementation of a cache invalidation bridge Based on previous code of Bill Burke based on interceptors

Version:
$Revision: 1.2.6.1 $

Revisions:

28 septembre 2002 Sacha Labourey:

  • First implementation
Author:
Sacha Labourey., Bill Burke.
See Also:
InvalidationManagerMBean

Field Summary
protected  int acknowledgeMode
           
protected  javax.jms.TopicConnection conn
           
protected  String connectionFactoryName
           
protected  String invalidationManagerName
           
protected  BridgeInvalidationSubscription invalidationSubscription
           
protected  InvalidationManagerMBean invalMgr
           
static String JMS_CACHE_INVALIDATION_BRIDGE
           
protected  int propagationMode
           
protected  String providerUrl
           
protected  javax.jms.TopicPublisher pub
           
protected  boolean publishingAuthorized
           
protected  VMID serviceId
           
protected  javax.jms.TopicSession session
           
protected  javax.jms.TopicSubscriber subscriber
           
protected  javax.jms.Topic topic
           
protected  String topicName
           
protected  boolean transacted
           
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.cache.invalidation.bridges.JMSCacheInvalidationBridgeMBean
AUTO_ACKNOWLEDGE_MODE, CLIENT_ACKNOWLEDGE_MODE, DUPS_OK_ACKNOWLEDGE_MODE, IN_ONLY_BRIDGE_PROPAGATION, IN_OUT_BRIDGE_PROPAGATION, OUT_ONLY_BRIDGE_PROPAGATION
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
JMSCacheInvalidationBridge()
           
 
Method Summary
 void batchInvalidate(BatchInvalidation[] invalidations, boolean asynchronous)
          Called when a set of invalidations, concerning more than one IG, should be forwarded accross the bridge.
 int getAcknowledgeMode()
          Status of the JMS topic wrt messages acknowledgement
 String getConnectionFactoryName()
          JNDI name of the JMS connection factory to use for cache invalidations
protected  InitialContext getInitialContext()
           
 String getInvalidationManager()
          ObjectName of the InvalidationManager to be used.
 int getPropagationMode()
          Indicates if this bridge should: 1 - Post local invalidations to the topic and invalidate local caches with invalidations received on the topic 2 - Only invalidate local caches with invalidations received on the topic but not post anything on the topic 3 - Only post local invalidations to the topic and not listen to the Topic for invalidation messages
 String getProviderUrl()
          Provider URL to use for JMS access.
protected  javax.jms.TopicPublisher getPublisher()
           
protected  javax.jms.TopicSession getSession()
           
 String getTopicName()
          JNDI name of the Topic to use to send/receive cache invalidations.
 void groupIsDropped(String groupInvalidationName)
          Called when an InvocationGroup is dropped (because no cache and invalider are using it anymore).
 void invalidate(String invalidationGroupName, Serializable[] keys, boolean asynchronous)
          Called when a set of invalidations, concerning a single IG, should be forwarded accross the bridge.
 void invalidate(String invalidationGroupName, Serializable key, boolean asynchronous)
          Called when a single invalidation, concerning a single IG, should be forwarded accross the bridge.
 void invalidateAll(String groupName, boolean asynchronous)
          Issues invalidate all event to other nodes.
 boolean isTransacted()
          Status of the JMS topic wrt transactions
 void newGroupCreated(String groupInvalidationName)
          Called when an InvocationGroup is created.
 void onMessage(javax.jms.Message msg)
           
protected  void sendJMSInvalidationEvent(JMSCacheInvalidationMessage invalidationMsg)
           
 void setAcknowledgeMode(int ackMode)
           
 void setConnectionFactoryName(String factoryName)
           
 void setInvalidationManager(String objectName)
           
 void setPropagationMode(int propMode)
           
 void setProviderUrl(String providerUrl)
           
 void setTopicName(String topicName)
           
 void setTransacted(boolean isTransacted)
           
protected  void startService()
           
protected  void stopService()
           
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Field Detail

JMS_CACHE_INVALIDATION_BRIDGE

public static final String JMS_CACHE_INVALIDATION_BRIDGE
See Also:
Constant Field Values

invalMgr

protected InvalidationManagerMBean invalMgr

invalidationSubscription

protected BridgeInvalidationSubscription invalidationSubscription

invalidationManagerName

protected String invalidationManagerName

publishingAuthorized

protected boolean publishingAuthorized

connectionFactoryName

protected String connectionFactoryName

topicName

protected String topicName

transacted

protected boolean transacted

acknowledgeMode

protected int acknowledgeMode

propagationMode

protected int propagationMode

serviceId

protected VMID serviceId

conn

protected javax.jms.TopicConnection conn

session

protected javax.jms.TopicSession session

topic

protected javax.jms.Topic topic

subscriber

protected javax.jms.TopicSubscriber subscriber

pub

protected javax.jms.TopicPublisher pub

providerUrl

protected String providerUrl
Constructor Detail

JMSCacheInvalidationBridge

public JMSCacheInvalidationBridge()
Method Detail

getInvalidationManager

public String getInvalidationManager()
Description copied from interface: JMSCacheInvalidationBridgeMBean
ObjectName of the InvalidationManager to be used. Optional: in this case, the default InvalidationManager is used.

Specified by:
getInvalidationManager in interface JMSCacheInvalidationBridgeMBean

setInvalidationManager

public void setInvalidationManager(String objectName)
Specified by:
setInvalidationManager in interface JMSCacheInvalidationBridgeMBean

getConnectionFactoryName

public String getConnectionFactoryName()
Description copied from interface: JMSCacheInvalidationBridgeMBean
JNDI name of the JMS connection factory to use for cache invalidations

Specified by:
getConnectionFactoryName in interface JMSCacheInvalidationBridgeMBean

setConnectionFactoryName

public void setConnectionFactoryName(String factoryName)
Specified by:
setConnectionFactoryName in interface JMSCacheInvalidationBridgeMBean

getTopicName

public String getTopicName()
Description copied from interface: JMSCacheInvalidationBridgeMBean
JNDI name of the Topic to use to send/receive cache invalidations. Defaults to "topic/JMSCacheInvalidationBridge"

Specified by:
getTopicName in interface JMSCacheInvalidationBridgeMBean

setTopicName

public void setTopicName(String topicName)
Specified by:
setTopicName in interface JMSCacheInvalidationBridgeMBean

getProviderUrl

public String getProviderUrl()
Description copied from interface: JMSCacheInvalidationBridgeMBean
Provider URL to use for JMS access. If null, use the default settings

Specified by:
getProviderUrl in interface JMSCacheInvalidationBridgeMBean

setProviderUrl

public void setProviderUrl(String providerUrl)
Specified by:
setProviderUrl in interface JMSCacheInvalidationBridgeMBean

isTransacted

public boolean isTransacted()
Description copied from interface: JMSCacheInvalidationBridgeMBean
Status of the JMS topic wrt transactions

Specified by:
isTransacted in interface JMSCacheInvalidationBridgeMBean

setTransacted

public void setTransacted(boolean isTransacted)
Specified by:
setTransacted in interface JMSCacheInvalidationBridgeMBean

getAcknowledgeMode

public int getAcknowledgeMode()
Description copied from interface: JMSCacheInvalidationBridgeMBean
Status of the JMS topic wrt messages acknowledgement

Specified by:
getAcknowledgeMode in interface JMSCacheInvalidationBridgeMBean

setAcknowledgeMode

public void setAcknowledgeMode(int ackMode)
Specified by:
setAcknowledgeMode in interface JMSCacheInvalidationBridgeMBean

getPropagationMode

public int getPropagationMode()
Description copied from interface: JMSCacheInvalidationBridgeMBean
Indicates if this bridge should: 1 - Post local invalidations to the topic and invalidate local caches with invalidations received on the topic 2 - Only invalidate local caches with invalidations received on the topic but not post anything on the topic 3 - Only post local invalidations to the topic and not listen to the Topic for invalidation messages

Specified by:
getPropagationMode in interface JMSCacheInvalidationBridgeMBean

setPropagationMode

public void setPropagationMode(int propMode)
Specified by:
setPropagationMode in interface JMSCacheInvalidationBridgeMBean

onMessage

public void onMessage(javax.jms.Message msg)
Specified by:
onMessage in interface javax.jms.MessageListener

batchInvalidate

public void batchInvalidate(BatchInvalidation[] invalidations,
                            boolean asynchronous)
Description copied from interface: InvalidationBridgeListener
Called when a set of invalidations, concerning more than one IG, should be forwarded accross the bridge. It is the bridge responsability to determine: - which IG must be bridged (some IG may not exist on other nodes, in this case the bridge may decide to drop these invalidations messages to reduce the serialization cost and network usage) - to which other nodes the invalidations must be communicated. This can be done by any mean (automatic discovery, configuration file, etc.)

Specified by:
batchInvalidate in interface InvalidationBridgeListener
Parameters:
invalidations - BatchInvalidation messages containing invalidations
asynchronous - Determine the best-effort indication to be used to communicate invalidations

invalidate

public void invalidate(String invalidationGroupName,
                       Serializable[] keys,
                       boolean asynchronous)
Description copied from interface: InvalidationBridgeListener
Called when a set of invalidations, concerning a single IG, should be forwarded accross the bridge. It is the bridge responsability to determine: - which IG must be bridged (some IG may not exist on other nodes, in this case the bridge may decide to drop these invalidations messages to reduce the serialization cost and network usage) - to which other nodes the invalidations must be communicated. This can be done by any mean (automatic discovery, configuration file, etc.)

Specified by:
invalidate in interface InvalidationBridgeListener
Parameters:
invalidationGroupName - Name of the InvalidationGroup to which is linked the invalidation message
keys - Keys to be invalidated
asynchronous - Best effort communication setting

invalidate

public void invalidate(String invalidationGroupName,
                       Serializable key,
                       boolean asynchronous)
Description copied from interface: InvalidationBridgeListener
Called when a single invalidation, concerning a single IG, should be forwarded accross the bridge. It is the bridge responsability to determine: - which IG must be bridged (some IG may not exist on other nodes, in this case the bridge may decide to drop these invalidations messages to reduce the serialization cost and network usage) - to which other nodes the invalidations must be communicated. This can be done by any mean (automatic discovery, configuration file, etc.)

Specified by:
invalidate in interface InvalidationBridgeListener
Parameters:
invalidationGroupName - InvalidationGroup name
key - Key to be invalidated
asynchronous - Best effort communication setting

invalidateAll

public void invalidateAll(String groupName,
                          boolean asynchronous)
Description copied from interface: InvalidationBridgeListener
Issues invalidate all event to other nodes.

Specified by:
invalidateAll in interface InvalidationBridgeListener
Parameters:
groupName - group's name
asynchronous - mode

newGroupCreated

public void newGroupCreated(String groupInvalidationName)
Description copied from interface: InvalidationBridgeListener
Called when an InvocationGroup is created. For bridge implementations that automatically discover which IG should be bridged, this callback can be used to communicate to the other nodes that this node is now interested in invalidation for this group.

Specified by:
newGroupCreated in interface InvalidationBridgeListener
Parameters:
groupInvalidationName - Name of the InvalidationGroup just being created

groupIsDropped

public void groupIsDropped(String groupInvalidationName)
Description copied from interface: InvalidationBridgeListener
Called when an InvocationGroup is dropped (because no cache and invalider are using it anymore). For bridge implementations that automatically discover which IG should be bridged, this callback can be used to communicate to the other nodes that this node is no more interested in invalidation for this group.

Specified by:
groupIsDropped in interface InvalidationBridgeListener
Parameters:
groupInvalidationName - Name of the InvalidationGroup being dropped

startService

protected void startService()
                     throws Exception
Throws:
Exception

stopService

protected void stopService()

getSession

protected javax.jms.TopicSession getSession()

getPublisher

protected javax.jms.TopicPublisher getPublisher()

sendJMSInvalidationEvent

protected void sendJMSInvalidationEvent(JMSCacheInvalidationMessage invalidationMsg)

getInitialContext

protected InitialContext getInitialContext()
                                    throws NamingException
Throws:
NamingException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.