Top Description Fields Constructors Methods
net.sf.ehcache.terracotta

public Class TerracottaCacheCluster

extends Object
implements CacheCluster
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.cluster.CacheCluster
Imports
java.util.Collection, .HashSet, .List, .Set, java.util.concurrent.CopyOnWriteArrayList, net.sf.ehcache.CacheException, net.sf.ehcache.cluster.CacheCluster, .ClusterNode, .ClusterScheme, .ClusterTopologyListener, org.slf4j.Logger, .LoggerFactory

CacheCluster implementation that delegates to an underlying cache cluster. The underlying CacheCluster can be changed dynamically
Author
Abhishek Sanoujam

Field Summary

Modifier and TypeField and Description
private final List<ClusterTopologyListener>
private static final Logger
private volatile CacheCluster

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
addTopologyListener(ClusterTopologyListener
Listener
listener
)

Implements net.sf.ehcache.cluster.CacheCluster.addTopologyListener.

Add a listener for cluster events
private void
pack-priv void
fireNodeRejoinedEvent(ClusterNode oldNode, ClusterNode newNode)

Fire Rejoin event to all listeners.

private void
public ClusterNode
getCurrentNode()

Implements net.sf.ehcache.cluster.CacheCluster.getCurrentNode.

Retrieves the ClusterNode instance that corresponds to the current node.
public Collection<ClusterNode>
getNodes()

Implements net.sf.ehcache.cluster.CacheCluster.getNodes.

Get all the nodes in the cluster
public ClusterScheme
getScheme()

Implements net.sf.ehcache.cluster.CacheCluster.getScheme.

Get scheme name for this cluster info.
public List<ClusterTopologyListener>
public boolean
isClusterOnline()

Implements net.sf.ehcache.cluster.CacheCluster.isClusterOnline.

Find out if the current node is connected to the cluster or not
public void
removeAllListeners()

Implements net.sf.ehcache.cluster.CacheCluster.removeAllListeners.

Removes all listeners for cluster events
public boolean
removeTopologyListener(ClusterTopologyListener
Listener
listener
)

Implements net.sf.ehcache.cluster.CacheCluster.removeTopologyListener.

Remove a listener for cluster events
public void
setUnderlyingCacheCluster(CacheCluster newCacheCluster)

Set the underlying cache

public ClusterNode
waitUntilNodeJoinsCluster()

Implements net.sf.ehcache.cluster.CacheCluster.waitUntilNodeJoinsCluster.

Waits until the current node has successfully joined the cluster.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

listenersback to summary
private final List<ClusterTopologyListener> listeners
LOGGERback to summary
private static final Logger LOGGER
realCacheClusterback to summary
private volatile CacheCluster realCacheCluster

Constructor Detail

TerracottaCacheClusterback to summary
public TerracottaCacheCluster()

Method Detail

addTopologyListenerback to summary
public boolean addTopologyListener(ClusterTopologyListener listener)

Implements net.sf.ehcache.cluster.CacheCluster.addTopologyListener.

Doc from net.sf.ehcache.cluster.CacheCluster.addTopologyListener.

Add a listener for cluster events

Parameters
listener:ClusterTopologyListener

Listener

Returns:boolean

True if already listening

checkIfInitializedback to summary
private void checkIfInitialized()
fireNodeRejoinedEventback to summary
pack-priv void fireNodeRejoinedEvent(ClusterNode oldNode, ClusterNode newNode)

Fire Rejoin event to all listeners. Package protected method

fireRejoinEventback to summary
private void fireRejoinEvent(ClusterNode oldNode, ClusterNode newNode, ClusterTopologyListener listener)
getCurrentNodeback to summary
public ClusterNode getCurrentNode()

Implements net.sf.ehcache.cluster.CacheCluster.getCurrentNode.

Doc from net.sf.ehcache.cluster.CacheCluster.getCurrentNode.

Retrieves the ClusterNode instance that corresponds to the current node.

Returns:ClusterNode

the ClusterNode instance that corresponds to the current node

getNodesback to summary
public Collection<ClusterNode> getNodes()

Implements net.sf.ehcache.cluster.CacheCluster.getNodes.

Doc from net.sf.ehcache.cluster.CacheCluster.getNodes.

Get all the nodes in the cluster

Returns:Collection<ClusterNode>

information on all the nodes in the cluster, including ID, hostname, and IP address.

getSchemeback to summary
public ClusterScheme getScheme()

Implements net.sf.ehcache.cluster.CacheCluster.getScheme.

Doc from net.sf.ehcache.cluster.CacheCluster.getScheme.

Get scheme name for this cluster info.

Returns:ClusterScheme

a scheme name for the cluster information. Currently TERRACOTTA is the only scheme supported.

getTopologyListenersback to summary
public List<ClusterTopologyListener> getTopologyListeners()

Implements net.sf.ehcache.cluster.CacheCluster.getTopologyListeners.

Doc from net.sf.ehcache.cluster.CacheCluster.getTopologyListeners.

Get all the topology listeners

Returns:List<ClusterTopologyListener>

a list of all the topology listeners

isClusterOnlineback to summary
public boolean isClusterOnline()

Implements net.sf.ehcache.cluster.CacheCluster.isClusterOnline.

Doc from net.sf.ehcache.cluster.CacheCluster.isClusterOnline.

Find out if the current node is connected to the cluster or not

Returns:boolean

true if cluster is online otherwise false

removeAllListenersback to summary
public void removeAllListeners()

Implements net.sf.ehcache.cluster.CacheCluster.removeAllListeners.

Doc from net.sf.ehcache.cluster.CacheCluster.removeAllListeners.

Removes all listeners for cluster events

Annotations
@Override
removeTopologyListenerback to summary
public boolean removeTopologyListener(ClusterTopologyListener listener)

Implements net.sf.ehcache.cluster.CacheCluster.removeTopologyListener.

Doc from net.sf.ehcache.cluster.CacheCluster.removeTopologyListener.

Remove a listener for cluster events

Parameters
listener:ClusterTopologyListener

Listener

Returns:boolean

True if not listening

setUnderlyingCacheClusterback to summary
public void setUnderlyingCacheCluster(CacheCluster newCacheCluster)

Set the underlying cache

waitUntilNodeJoinsClusterback to summary
public ClusterNode waitUntilNodeJoinsCluster()

Implements net.sf.ehcache.cluster.CacheCluster.waitUntilNodeJoinsCluster.

Doc from net.sf.ehcache.cluster.CacheCluster.waitUntilNodeJoinsCluster.

Waits until the current node has successfully joined the cluster.

Returns:ClusterNode

the ClusterNode instance that corresponds to the current node