org.jboss.cache.invalidation.bridges
Class JGCacheInvalidationBridge

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.cache.invalidation.bridges.JGCacheInvalidationBridge
All Implemented Interfaces:
DistributedReplicantManager.ReplicantListener (src) , DistributedState.DSListenerEx (src) , InvalidationBridgeListener (src) , JGCacheInvalidationBridgeMBean (src) , MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src)

public class JGCacheInvalidationBridge
extends ServiceMBeanSupport (src)
implements JGCacheInvalidationBridgeMBean (src) , DistributedState.DSListenerEx (src) , InvalidationBridgeListener (src) , DistributedReplicantManager.ReplicantListener (src)

JGroups implementation of a cache invalidation bridge

See Also:
JGCacheInvalidationBridgeMBean (src)

Field Summary
protected  java.util.Vector bridgedGroups
           
protected  java.lang.String bridgeName
           
protected  DistributedReplicantManager (src) drm
           
protected  DistributedState (src) ds
           
protected  java.lang.String invalidationManagerName
           
protected  BridgeInvalidationSubscription (src) invalidationSubscription
           
protected  InvalidationManagerMBean (src) invalMgr
           
protected  java.util.Collection localGroups
           
protected  java.lang.String nodeName
           
protected  HAPartition (src) partition
           
protected  java.lang.String partitionName
           
protected  java.lang.Class[] rpc_batch_invalidate_types
           
protected  java.lang.String RPC_HANLE_NAME
           
protected  java.lang.Class[] rpc_invalidate_all_types
           
protected  java.lang.Class[] rpc_invalidate_types
           
protected  java.lang.Class[] rpc_invalidates_types
           
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
JGCacheInvalidationBridge()
           
 
Method Summary
protected  void _do_rpc_batchInvalidate(BatchInvalidation (src) [] invalidations, boolean asynch)
           
protected  void _do_rpc_invalidate_all(java.lang.String invalidationGroupName, boolean asynch)
           
protected  void _do_rpc_invalidate(java.lang.String invalidationGroupName, java.io.Serializable key, boolean asynch)
           
protected  void _do_rpc_invalidates(java.lang.String invalidationGroupName, java.io.Serializable[] keys, boolean asynch)
           
 void _rpc_batchInvalidate(BatchInvalidation (src) [] invalidations)
           
 void _rpc_invalidate_all(java.lang.String invalidationGroupName)
           
 void _rpc_invalidate(java.lang.String invalidationGroupName, java.io.Serializable key)
           
 void _rpc_invalidates(java.lang.String invalidationGroupName, java.io.Serializable[] keys)
           
 void batchInvalidate(BatchInvalidation (src) [] invalidations, boolean asynchronous)
          Called when a set of invalidations, concerning more than one IG, should be forwarded accross the bridge.
 java.lang.String getBridgeName()
           
 java.lang.String getInvalidationManager()
          ObjectName of the InvalidationManager to be used.
 java.lang.String getPartitionName()
          Name of the Clustering partition to be used to exchange invalidation messages and discover which caches (i.e.
protected  boolean groupExistsRemotely(java.lang.String groupName)
           
 void groupIsDropped(java.lang.String groupInvalidationName)
          Called when an InvocationGroup is dropped (because no cache and invalider are using it anymore).
 void invalidate(java.lang.String invalidationGroupName, java.io.Serializable[] keys, boolean asynchronous)
          Called when a set of invalidations, concerning a single IG, should be forwarded accross the bridge.
 void invalidate(java.lang.String invalidationGroupName, java.io.Serializable key, boolean asynchronous)
          Called when a single invalidation, concerning a single IG, should be forwarded accross the bridge.
 void invalidateAll(java.lang.String groupName, boolean async)
          Issues invalidate all event to other nodes.
 void keyHasBeenRemoved(java.lang.String category, java.io.Serializable key, java.io.Serializable previousContent, boolean locallyModified)
          Called whenever a key has been removed from a category the called object had subscribed in.
 void newGroupCreated(java.lang.String groupInvalidationName)
          Called when an InvocationGroup is created.
protected  void publishLocalInvalidationGroups()
           
 void replicantsChanged(java.lang.String key, java.util.List newReplicants, int newReplicantsViewId)
          Callback called when the content/list of replicant for a given replicant key has changed
 void setBridgeName(java.lang.String name)
           
 void setInvalidationManager(java.lang.String objectName)
           
 void setPartitionName(java.lang.String partitionName)
           
 void startService()
          Sub-classes should override this method to provide custum 'start' logic.
 void stopService()
          Sub-classes should override this method to provide custum 'stop' logic.
protected  void updatedBridgedInvalidationGroupsInfo()
           
 void valueHasChanged(java.lang.String category, java.io.Serializable key, java.io.Serializable value, boolean locallyModified)
          Called whenever a key has been added or modified in the category the called object has subscribed in.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
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 (src)
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 (src)
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service (src)
create, destroy, start, stop
 

Field Detail

partitionName

protected java.lang.String partitionName

invalidationManagerName

protected java.lang.String invalidationManagerName

bridgeName

protected java.lang.String bridgeName

partition

protected HAPartition (src)  partition

ds

protected DistributedState (src)  ds

drm

protected DistributedReplicantManager (src)  drm

RPC_HANLE_NAME

protected java.lang.String RPC_HANLE_NAME

nodeName

protected java.lang.String nodeName

invalMgr

protected InvalidationManagerMBean (src)  invalMgr

invalidationSubscription

protected BridgeInvalidationSubscription (src)  invalidationSubscription

localGroups

protected java.util.Collection localGroups

bridgedGroups

protected java.util.Vector bridgedGroups

rpc_invalidate_types

protected final java.lang.Class[] rpc_invalidate_types

rpc_invalidates_types

protected final java.lang.Class[] rpc_invalidates_types

rpc_invalidate_all_types

protected final java.lang.Class[] rpc_invalidate_all_types

rpc_batch_invalidate_types

protected final java.lang.Class[] rpc_batch_invalidate_types
Constructor Detail

JGCacheInvalidationBridge

public JGCacheInvalidationBridge()
Method Detail

getInvalidationManager

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

Specified by:
getInvalidationManager in interface JGCacheInvalidationBridgeMBean (src)

getPartitionName

public java.lang.String getPartitionName()
Description copied from interface: JGCacheInvalidationBridgeMBean (src)
Name of the Clustering partition to be used to exchange invalidation messages and discover which caches (i.e. InvalidationGroup) are available

Specified by:
getPartitionName in interface JGCacheInvalidationBridgeMBean (src)

setInvalidationManager

public void setInvalidationManager(java.lang.String objectName)
Specified by:
setInvalidationManager in interface JGCacheInvalidationBridgeMBean (src)

setPartitionName

public void setPartitionName(java.lang.String partitionName)
Specified by:
setPartitionName in interface JGCacheInvalidationBridgeMBean (src)

getBridgeName

public java.lang.String getBridgeName()
Specified by:
getBridgeName in interface JGCacheInvalidationBridgeMBean (src)

setBridgeName

public void setBridgeName(java.lang.String name)
Specified by:
setBridgeName in interface JGCacheInvalidationBridgeMBean (src)

replicantsChanged

public void replicantsChanged(java.lang.String key,
                              java.util.List newReplicants,
                              int newReplicantsViewId)
Description copied from interface: DistributedReplicantManager.ReplicantListener (src)
Callback called when the content/list of replicant for a given replicant key has changed

Specified by:
replicantsChanged in interface DistributedReplicantManager.ReplicantListener (src)
Parameters:
key - The name of the key of the replicant that has changed
newReplicants - The list of new replicants for the give replicant key
newReplicantsViewId - The new replicant view id corresponding to this change

valueHasChanged

public void valueHasChanged(java.lang.String category,
                            java.io.Serializable key,
                            java.io.Serializable value,
                            boolean locallyModified)
Description copied from interface: DistributedState.DSListenerEx (src)
Called whenever a key has been added or modified in the category the called object has subscribed in.

Specified by:
valueHasChanged in interface DistributedState.DSListenerEx (src)
Parameters:
category - The category of the modified/added entry
key - The key that has been added or its value modified
value - The new value of the key

keyHasBeenRemoved

public void keyHasBeenRemoved(java.lang.String category,
                              java.io.Serializable key,
                              java.io.Serializable previousContent,
                              boolean locallyModified)
Description copied from interface: DistributedState.DSListenerEx (src)
Called whenever a key has been removed from a category the called object had subscribed in.

Specified by:
keyHasBeenRemoved in interface DistributedState.DSListenerEx (src)
Parameters:
category - The category under which a key has been removed
key - The key that has been removed
previousContent - The previous content of the key that has been removed

batchInvalidate

public void batchInvalidate(BatchInvalidation (src) [] invalidations,
                            boolean asynchronous)
Description copied from interface: InvalidationBridgeListener (src)
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 (src)
Parameters:
invalidations - BatchInvalidation messages containing invalidations
asynchronous - Determine the best-effort indication to be used to communicate invalidations

invalidate

public void invalidate(java.lang.String invalidationGroupName,
                       java.io.Serializable[] keys,
                       boolean asynchronous)
Description copied from interface: InvalidationBridgeListener (src)
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 (src)
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(java.lang.String invalidationGroupName,
                       java.io.Serializable key,
                       boolean asynchronous)
Description copied from interface: InvalidationBridgeListener (src)
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 (src)
Parameters:
invalidationGroupName - InvalidationGroup name
key - Key to be invalidated
asynchronous - Best effort communication setting

invalidateAll

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

Specified by:
invalidateAll in interface InvalidationBridgeListener (src)
Parameters:
groupName - group's name
async - mode

newGroupCreated

public void newGroupCreated(java.lang.String groupInvalidationName)
Description copied from interface: InvalidationBridgeListener (src)
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 (src)
Parameters:
groupInvalidationName - Name of the InvalidationGroup just being created

groupIsDropped

public void groupIsDropped(java.lang.String groupInvalidationName)
Description copied from interface: InvalidationBridgeListener (src)
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 (src)
Parameters:
groupInvalidationName - Name of the InvalidationGroup being dropped

startService

public void startService()
                  throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'start' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
startService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

stopService

public void stopService()
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'stop' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
stopService in class ServiceMBeanSupport (src)

_rpc_invalidate

public void _rpc_invalidate(java.lang.String invalidationGroupName,
                            java.io.Serializable key)

_rpc_invalidates

public void _rpc_invalidates(java.lang.String invalidationGroupName,
                             java.io.Serializable[] keys)

_rpc_invalidate_all

public void _rpc_invalidate_all(java.lang.String invalidationGroupName)

_rpc_batchInvalidate

public void _rpc_batchInvalidate(BatchInvalidation (src) [] invalidations)

_do_rpc_invalidate

protected void _do_rpc_invalidate(java.lang.String invalidationGroupName,
                                  java.io.Serializable key,
                                  boolean asynch)

_do_rpc_invalidates

protected void _do_rpc_invalidates(java.lang.String invalidationGroupName,
                                   java.io.Serializable[] keys,
                                   boolean asynch)

_do_rpc_invalidate_all

protected void _do_rpc_invalidate_all(java.lang.String invalidationGroupName,
                                      boolean asynch)

_do_rpc_batchInvalidate

protected void _do_rpc_batchInvalidate(BatchInvalidation (src) [] invalidations,
                                       boolean asynch)

publishLocalInvalidationGroups

protected void publishLocalInvalidationGroups()
                                       throws java.lang.Exception
Throws:
java.lang.Exception

updatedBridgedInvalidationGroupsInfo

protected void updatedBridgedInvalidationGroupsInfo()

groupExistsRemotely

protected boolean groupExistsRemotely(java.lang.String groupName)