ehcache

net.sf.ehcache.terracotta
Class TerracottaCacheCluster

java.lang.Object
  extended by net.sf.ehcache.terracotta.TerracottaCacheCluster
All Implemented Interfaces:
CacheCluster

public class TerracottaCacheCluster
extends Object
implements CacheCluster

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

Author:
Abhishek Sanoujam

Constructor Summary
TerracottaCacheCluster()
           
 
Method Summary
 boolean addTopologyListener(ClusterTopologyListener listener)
          Add a listener for cluster events
 ClusterNode getCurrentNode()
          Retrieves the ClusterNode instance that corresponds to the current node.
 Collection<ClusterNode> getNodes()
          Get all the nodes in the cluster
 ClusterScheme getScheme()
          Get scheme name for this cluster info.
 List<ClusterTopologyListener> getTopologyListeners()
          Get all the topology listeners
 boolean isClusterOnline()
          Find out if the current node is connected to the cluster or not
 void removeAllListeners()
          Removes all listeners for cluster events
 boolean removeTopologyListener(ClusterTopologyListener listener)
          Remove a listener for cluster events
 void setUnderlyingCacheCluster(CacheCluster newCacheCluster)
          Set the underlying cache
 ClusterNode waitUntilNodeJoinsCluster()
          Waits until the current node has successfully joined the cluster.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TerracottaCacheCluster

public TerracottaCacheCluster()
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:
addTopologyListener in interface CacheCluster
Parameters:
listener - Listener
Returns:
True if already listening

removeTopologyListener

public boolean removeTopologyListener(ClusterTopologyListener listener)
Remove a listener for cluster events

Specified by:
removeTopologyListener in interface CacheCluster
Parameters:
listener - Listener
Returns:
True if not listening

getCurrentNode

public ClusterNode getCurrentNode()
Retrieves the ClusterNode instance that corresponds to the current node.

Specified by:
getCurrentNode in interface CacheCluster
Returns:
the ClusterNode instance that corresponds to the current node

getNodes

public Collection<ClusterNode> getNodes()
Get all the nodes in the cluster

Specified by:
getNodes in interface CacheCluster
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:
getScheme in interface CacheCluster
Returns:
a scheme name for the cluster information. Currently TERRACOTTA is the only scheme supported.

isClusterOnline

public boolean isClusterOnline()
Find out if the current node is connected to the cluster or not

Specified by:
isClusterOnline in interface CacheCluster
Returns:
true if cluster is online otherwise false

waitUntilNodeJoinsCluster

public ClusterNode waitUntilNodeJoinsCluster()
Waits until the current node has successfully joined the cluster.

Specified by:
waitUntilNodeJoinsCluster in interface CacheCluster
Returns:
the ClusterNode instance that corresponds to the current node

getTopologyListeners

public List<ClusterTopologyListener> getTopologyListeners()
Get all the topology listeners

Specified by:
getTopologyListeners in interface CacheCluster
Returns:
a list of all the topology listeners

removeAllListeners

public void removeAllListeners()
Description copied from interface: CacheCluster
Removes all listeners for cluster events

Specified by:
removeAllListeners in interface CacheCluster

ehcache

Copyright 2001-2014, Terracotta, Inc.