Package net.sf.ehcache.cluster
Interface CacheCluster
-
- All Known Implementing Classes:
NoopCacheCluster,TerracottaCacheCluster
public interface CacheClusterAllows you to explore the Terracotta cluster nodes and register for events about the cluster.- Since:
- 2.0
- Author:
- Geert Bevin, Abhishek Sanoujam
-
-
Method Summary
All Methods Instance Methods Abstract 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 eventsClusterNodewaitUntilNodeJoinsCluster()Waits until the current node has successfully joined the cluster.
-
-
-
Method Detail
-
getScheme
ClusterScheme getScheme()
Get scheme name for this cluster info.- Returns:
- a scheme name for the cluster information.
Currently
TERRACOTTAis the only scheme supported.
-
getCurrentNode
ClusterNode getCurrentNode()
Retrieves theClusterNodeinstance that corresponds to the current node.- Returns:
- the
ClusterNodeinstance that corresponds to the current node
-
waitUntilNodeJoinsCluster
ClusterNode waitUntilNodeJoinsCluster()
Waits until the current node has successfully joined the cluster.- Returns:
- the
ClusterNodeinstance that corresponds to the current node
-
getNodes
java.util.Collection<ClusterNode> getNodes()
Get all the nodes in the cluster- Returns:
- information on all the nodes in the cluster, including ID, hostname, and IP address.
-
isClusterOnline
boolean isClusterOnline()
Find out if the current node is connected to the cluster or not- Returns:
- true if cluster is online otherwise false
-
addTopologyListener
boolean addTopologyListener(ClusterTopologyListener listener)
Add a listener for cluster events- Parameters:
listener- Listener- Returns:
- True if already listening
-
removeTopologyListener
boolean removeTopologyListener(ClusterTopologyListener listener)
Remove a listener for cluster events- Parameters:
listener- Listener- Returns:
- True if not listening
-
removeAllListeners
void removeAllListeners()
Removes all listeners for cluster events
-
getTopologyListeners
java.util.List<ClusterTopologyListener> getTopologyListeners()
Get all the topology listeners- Returns:
- a list of all the topology listeners
-
-