Package net.sf.ehcache.cluster
Class NoopCacheCluster
- java.lang.Object
-
- net.sf.ehcache.cluster.NoopCacheCluster
-
- All Implemented Interfaces:
CacheCluster
public class NoopCacheCluster extends java.lang.Object implements CacheCluster
This is a dummy implementation of the CacheCluster (Null Object Pattern). It ignores all listeners and reports no nodes.- Since:
- 2.0
- Author:
- Geert Bevin
-
-
Field Summary
Fields Modifier and Type Field Description static CacheClusterINSTANCEA singleton instance you can use rather than constructing your own.
-
Constructor Summary
Constructors Constructor Description NoopCacheCluster()
-
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()Always returns the ClusterScheme.NONEjava.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.
-
-
-
Field Detail
-
INSTANCE
public static final CacheCluster INSTANCE
A singleton instance you can use rather than constructing your own.
-
-
Method Detail
-
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()
Always returns the ClusterScheme.NONE- Specified by:
getSchemein interfaceCacheCluster- Returns:
ClusterScheme.NONE
-
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
-
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
-
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
-
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
-
-