Cluster Topology
The interface net.sf.ehcache.cluster.CacheCluster provides methods for obtaining topology information for a Terracotta cluster. The following methods are available:
String getScheme() Returns a scheme name for the cluster information. Currently TERRACOTTA is the only scheme supported. The scheme name is used by CacheManager.getCluster() to return cluster information.
Collection<ClusterNode> getNodes() Returns information on all the nodes in the cluster, including ID, hostname, and IP address.
boolean addTopologyListener(ClusterTopologyListener listener) Adds a cluster-events listener. Returns true if the listener is already active.
boolean removeTopologyListener(ClusterTopologyListener) Removes a cluster-events listener. Returns true if the listener is already inactive.
The interface net.sf.ehcache.cluster.ClusterNode provides methods for obtaining information on specific cluster nodes.
public interface ClusterNode {
/**
* Get a unique (per cluster) identifier for this node.
*
* @return Unique per cluster identifier
*/
String getId();
/**
* Get the host name of the node
*
* @return Host name of node
*/
String getHostname();
/**
* Get the IP address of the node
*
* @return IP address of node
*/
String getIp();
}