com.atlassian.confluence.cluster.tangosol
Class TangosolClusterManager

java.lang.Object
  extended by com.atlassian.confluence.cluster.tangosol.TangosolClusterManager
All Implemented Interfaces:
ClusterManager, NameResolver, LockFactory

public class TangosolClusterManager
extends java.lang.Object
implements ClusterManager, NameResolver

Implementation of a cluster manager that uses Tangosol Coherence


Nested Class Summary
static class TangosolClusterManager.RetryOperation
           
 
Field Summary
protected static org.apache.log4j.Category log
           
 
Constructor Summary
TangosolClusterManager(com.atlassian.config.ApplicationConfig applicationConfig, java.lang.ClassLoader applicationClassLoader, SynchronizationManager synchronizationManager)
           
 
Method Summary
 void configure(ClusterConfig config)
          Set a new cluster config but do not cycle the service
static java.util.Collection enumerateCacheServices()
           
 ClusteredLock getClusteredLock(java.lang.String key)
          Get a distributed lock -- getting the lock does *not* imply that it has been acquired.
 ClusterInformation getClusterInformation()
          Get information about the running cluster.
 com.atlassian.core.task.FifoBuffer getFifoBuffer(java.lang.String name)
          Get a distributed FIFO buffer
 com.tangosol.net.InvocationService getInvocationService()
           
 Lock getLock(java.lang.String key)
          Get a lock -- getting the lock does *not* imply that it has been acquired.
 int getPermittedClusterNodes()
           
 java.io.Serializable getPublishedObject(java.lang.String key)
          Retrieve an object which another node in the cluster has shared, return null if no such object exists
 ClusterNodeInformation getThisNodeInformation()
          Get the identity of this node in the cluster.
 void init()
          Start the Invocation Service to listen for invocations (@see EventInvocable) from other nodes in the cluster.
 boolean isClustered()
           
 boolean isConfigured()
           
 void publishEvent(ConfluenceEvent event)
          Publish an event as a ClusterEventWrapper to other nodes
 void publishObject(java.lang.String key, java.io.Serializable object)
          Share an object to the cluster under a particular key
 void reconfigure(ClusterConfig config)
          Bootstrap a new cluster configuration.
protected  void registerClusterMemberEventLogger()
           
 java.net.InetAddress resolveName(java.lang.String name)
          Use this manager to resolver a cluster name to an IP address
 void shutdown()
           
 void startCluster()
          Start the clustering service
 void stopCluster()
          Stop the clustering service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Category log
Constructor Detail

TangosolClusterManager

public TangosolClusterManager(com.atlassian.config.ApplicationConfig applicationConfig,
                              java.lang.ClassLoader applicationClassLoader,
                              SynchronizationManager synchronizationManager)
Method Detail

enumerateCacheServices

public static java.util.Collection enumerateCacheServices()
Returns:
A collection of cache services running in the cluster

init

public void init()
Start the Invocation Service to listen for invocations (@see EventInvocable) from other nodes in the cluster.


shutdown

public void shutdown()

registerClusterMemberEventLogger

protected void registerClusterMemberEventLogger()

publishObject

public void publishObject(java.lang.String key,
                          java.io.Serializable object)
Description copied from interface: ClusterManager
Share an object to the cluster under a particular key

Specified by:
publishObject in interface ClusterManager

getPublishedObject

public java.io.Serializable getPublishedObject(java.lang.String key)
Description copied from interface: ClusterManager
Retrieve an object which another node in the cluster has shared, return null if no such object exists

Specified by:
getPublishedObject in interface ClusterManager
Returns:
a shared Object

isClustered

public boolean isClustered()
Specified by:
isClustered in interface ClusterManager
Returns:
true if this instance is configured to allow clustering with other nodes

getPermittedClusterNodes

public int getPermittedClusterNodes()
Specified by:
getPermittedClusterNodes in interface ClusterManager
Returns:
the number of clustered nodes permitted by the license. Returns a value less than or equal to zero if clustering is not permitted.

getClusterInformation

public ClusterInformation getClusterInformation()
Description copied from interface: ClusterManager
Get information about the running cluster.

Specified by:
getClusterInformation in interface ClusterManager

getLock

public Lock getLock(java.lang.String key)
Description copied from interface: LockFactory
Get a lock -- getting the lock does *not* imply that it has been acquired. Call Lock.tryLock() or Lock.lock() on the returned object to acquire the lock.

Specified by:
getLock in interface LockFactory

getClusteredLock

public ClusteredLock getClusteredLock(java.lang.String key)
Description copied from interface: ClusterManager
Get a distributed lock -- getting the lock does *not* imply that it has been acquired. Call Lock.tryLock() or Lock.lock() on the returned object to acquire the lock.

Specified by:
getClusteredLock in interface ClusterManager

getFifoBuffer

public com.atlassian.core.task.FifoBuffer getFifoBuffer(java.lang.String name)
Description copied from interface: ClusterManager
Get a distributed FIFO buffer

Specified by:
getFifoBuffer in interface ClusterManager

publishEvent

public void publishEvent(ConfluenceEvent event)
Description copied from interface: ClusterManager
Publish an event as a ClusterEventWrapper to other nodes

Specified by:
publishEvent in interface ClusterManager

getInvocationService

public com.tangosol.net.InvocationService getInvocationService()
Specified by:
getInvocationService in interface ClusterManager
Returns:
the Tangosol Coherence InvocationService which can be used for running code as an Invocable on all nodes in the cluster.
See Also:
Tangosol cluster services

getThisNodeInformation

public ClusterNodeInformation getThisNodeInformation()
Description copied from interface: ClusterManager
Get the identity of this node in the cluster. ClusterNodeInformation implements equals()

Specified by:
getThisNodeInformation in interface ClusterManager

stopCluster

public void stopCluster()
Description copied from interface: ClusterManager
Stop the clustering service

Specified by:
stopCluster in interface ClusterManager

startCluster

public void startCluster()
Description copied from interface: ClusterManager
Start the clustering service

Specified by:
startCluster in interface ClusterManager

resolveName

public java.net.InetAddress resolveName(java.lang.String name)
Use this manager to resolver a cluster name to an IP address

Specified by:
resolveName in interface NameResolver
Parameters:
name -
Returns:
Address of the cluster

configure

public void configure(ClusterConfig config)
Set a new cluster config but do not cycle the service

Specified by:
configure in interface ClusterManager
Parameters:
config -

isConfigured

public boolean isConfigured()
Specified by:
isConfigured in interface ClusterManager
Returns:
true if ClusterManager.configure(ClusterConfig) has been called with a valid configuration, otherwise false.

reconfigure

public void reconfigure(ClusterConfig config)
Bootstrap a new cluster configuration. This will cycle the clustering service

Specified by:
reconfigure in interface ClusterManager
Parameters:
config -


Copyright © 2003-2008 Atlassian Pty Ltd. All Rights Reserved.