Package net.sf.ehcache.terracotta
Class TerracottaCacheCluster
- java.lang.Object
-
- net.sf.ehcache.terracotta.TerracottaCacheCluster
-
- All Implemented Interfaces:
CacheCluster
public class TerracottaCacheCluster extends java.lang.Object implements CacheCluster
CacheClusterimplementation that delegates to an underlying cache cluster. The underlyingCacheClustercan be changed dynamically- Author:
- Abhishek Sanoujam
-
-
Constructor Summary
Constructors Constructor Description TerracottaCacheCluster()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddTopologyListener(ClusterTopologyListener listener)Add a listener for cluster eventsClusterNodegetCurrentNode()Retrieves theClusterNodeinstance that corresponds to the current node.java.util.Collection<ClusterNode>getNodes()Get all the nodes in the clusterClusterSchemegetScheme()Get scheme name for this cluster info.java.util.List<ClusterTopologyListener>getTopologyListeners()Get all the topology listenersbooleanisClusterOnline()Find out if the current node is connected to the cluster or notvoidremoveAllListeners()Removes all listeners for cluster eventsbooleanremoveTopologyListener(ClusterTopologyListener listener)Remove a listener for cluster eventsvoidsetUnderlyingCacheCluster(CacheCluster newCacheCluster)Set the underlying cacheClusterNodewaitUntilNodeJoinsCluster()Waits until the current node has successfully joined the cluster.
-
-
-
Method Detail
-
setUnderlyingCacheCluster
public void setUnderlyingCacheCluster(CacheCluster newCacheCluster)
Set the underlying cache- Parameters:
newCacheCluster-
-
addTopologyListener
public boolean addTopologyListener(ClusterTopologyListener listener)
Add a listener for cluster events- Specified by:
addTopologyListenerin interfaceCacheCluster- Parameters:
listener- Listener- Returns:
- True if already listening
-
removeTopologyListener
public boolean removeTopologyListener(ClusterTopologyListener listener)
Remove a listener for cluster events- Specified by:
removeTopologyListenerin interfaceCacheCluster- Parameters:
listener- Listener- Returns:
- True if not listening
-
getCurrentNode
public ClusterNode getCurrentNode()
Retrieves theClusterNodeinstance that corresponds to the current node.- Specified by:
getCurrentNodein interfaceCacheCluster- Returns:
- the
ClusterNodeinstance that corresponds to the current node
-
getNodes
public java.util.Collection<ClusterNode> getNodes()
Get all the nodes in the cluster- Specified by:
getNodesin interfaceCacheCluster- Returns:
- information on all the nodes in the cluster, including ID, hostname, and IP address.
-
getScheme
public ClusterScheme getScheme()
Get scheme name for this cluster info.- Specified by:
getSchemein interfaceCacheCluster- Returns:
- a scheme name for the cluster information.
Currently
TERRACOTTAis the only scheme supported.
-
isClusterOnline
public boolean isClusterOnline()
Find out if the current node is connected to the cluster or not- Specified by:
isClusterOnlinein interfaceCacheCluster- Returns:
- true if cluster is online otherwise false
-
waitUntilNodeJoinsCluster
public ClusterNode waitUntilNodeJoinsCluster()
Waits until the current node has successfully joined the cluster.- Specified by:
waitUntilNodeJoinsClusterin interfaceCacheCluster- Returns:
- the
ClusterNodeinstance that corresponds to the current node
-
getTopologyListeners
public java.util.List<ClusterTopologyListener> getTopologyListeners()
Get all the topology listeners- Specified by:
getTopologyListenersin interfaceCacheCluster- Returns:
- a list of all the topology listeners
-
removeAllListeners
public void removeAllListeners()
Description copied from interface:CacheClusterRemoves all listeners for cluster events- Specified by:
removeAllListenersin interfaceCacheCluster
-
-