ehcache

net.sf.ehcache.cluster
Class NoopCacheCluster

java.lang.Object
  extended by net.sf.ehcache.cluster.NoopCacheCluster
All Implemented Interfaces:
CacheCluster

public class NoopCacheCluster
extends 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
static CacheCluster INSTANCE
          A singleton instance you can use rather than constructing your own.
 
Constructor Summary
NoopCacheCluster()
           
 
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()
          Always returns the ClusterScheme.NONE
 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
 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
 

Field Detail

INSTANCE

public static final CacheCluster INSTANCE
A singleton instance you can use rather than constructing your own.

Constructor Detail

NoopCacheCluster

public NoopCacheCluster()
Method Detail

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()
Always returns the ClusterScheme.NONE

Specified by:
getScheme in interface CacheCluster
Returns:
ClusterScheme.NONE

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

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

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

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.