ehcache

net.sf.ehcache.store
Class AbstractStore

java.lang.Object
  extended by net.sf.ehcache.store.AbstractStore
All Implemented Interfaces:
Store
Direct Known Subclasses:
CompoundStore, DiskStore, LegacyStoreWrapper, LruMemoryStore, MemoryStore, XATransactionalStore

public abstract class AbstractStore
extends java.lang.Object
implements Store

Author:
gkeim

Field Summary
 
Fields inherited from interface net.sf.ehcache.store.Store
CLUSTER_COHERENT, NODE_COHERENT
 
Constructor Summary
AbstractStore()
           
 
Method Summary
 void addStoreListener(StoreListener listener)
          Add a listener to the store.
 void fireClusterCoherent(boolean clusterCoherent)
          Message to StoreListeners the cluster's coherence state.
 void fireNodeCoherent(boolean nodeCoherent)
          Message to StoreListeners the node's coherence state.
protected  java.util.List<StoreListener> getEventListenerList()
          onLoad initializer
 boolean isCacheCoherent()
          Indicates whether this store provides a coherent view of all the elements in a cache.
 boolean isClusterCoherent()
          Returns true if the cache is in coherent mode cluster-wide.
 boolean isNodeCoherent()
          Returns true if the cache is in coherent mode for the current node.
 void removeStoreListener(StoreListener listener)
          Remove listener from store.
 void setNodeCoherent(boolean coherent)
          Sets the cache in coherent or incoherent mode for the current node depending on the parameter.
 void waitUntilClusterCoherent()
          This method waits until the cache is in coherent mode in all the connected nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.ehcache.store.Store
bufferFull, containsKey, containsKeyInMemory, containsKeyOffHeap, containsKeyOnDisk, dispose, expireElements, flush, get, getInMemoryEvictionPolicy, getInMemorySize, getInMemorySizeInBytes, getInternalContext, getKeys, getMBean, getOffHeapSize, getOffHeapSizeInBytes, getOnDiskSize, getOnDiskSizeInBytes, getQuiet, getSize, getStatus, getTerracottaClusteredSize, put, putIfAbsent, putWithWriter, remove, removeAll, removeElement, removeWithWriter, replace, replace, setInMemoryEvictionPolicy
 

Constructor Detail

AbstractStore

public AbstractStore()
Method Detail

getEventListenerList

protected java.util.List<StoreListener> getEventListenerList()
onLoad initializer


isCacheCoherent

public boolean isCacheCoherent()
Indicates whether this store provides a coherent view of all the elements in a cache. Note that this is same as calling Store.isClusterCoherent() (introduced since 2.0) Use Store.isNodeCoherent() to find out if the cache is coherent in the current node in the cluster

Specified by:
isCacheCoherent in interface Store
Returns:
true if the store is coherent; or false if the store potentially splits the cache storage with another store or isn't internally coherent
See Also:
Store.isCacheCoherent()

isClusterCoherent

public boolean isClusterCoherent()
Returns true if the cache is in coherent mode cluster-wide. Returns false otherwise.

It applies to coherent clustering mechanisms only e.g. Terracotta

Specified by:
isClusterCoherent in interface Store
Returns:
true if the cache is in coherent mode cluster-wide, false otherwise
See Also:
Store.isClusterCoherent()

isNodeCoherent

public boolean isNodeCoherent()
Returns true if the cache is in coherent mode for the current node. Returns false otherwise.

It applies to coherent clustering mechanisms only e.g. Terracotta

Specified by:
isNodeCoherent in interface Store
Returns:
true if the cache is in coherent mode cluster-wide, false otherwise
See Also:
Store.isNodeCoherent()

setNodeCoherent

public void setNodeCoherent(boolean coherent)
                     throws java.lang.UnsupportedOperationException
Sets the cache in coherent or incoherent mode for the current node depending on the parameter. Calling setNodeCoherent(true) when the cache is already in coherent mode or calling setNodeCoherent(false) when already in incoherent mode will be a no-op.

It applies to coherent clustering mechanisms only e.g. Terracotta

Specified by:
setNodeCoherent in interface Store
Parameters:
coherent - true transitions to coherent mode, false to incoherent mode
Throws:
java.lang.UnsupportedOperationException - if this store does not support cache coherence, like RMI replication
See Also:
Store.setNodeCoherent(boolean)

waitUntilClusterCoherent

public void waitUntilClusterCoherent()
                              throws java.lang.UnsupportedOperationException
This method waits until the cache is in coherent mode in all the connected nodes. If the cache is already in coherent mode it returns immediately

It applies to coherent clustering mechanisms only e.g. Terracotta

Specified by:
waitUntilClusterCoherent in interface Store
Throws:
java.lang.UnsupportedOperationException - if this store does not support cache coherence, like RMI replication
See Also:
Store.waitUntilClusterCoherent()

addStoreListener

public void addStoreListener(StoreListener listener)
Add a listener to the store.

Specified by:
addStoreListener in interface Store
See Also:
Store.addStoreListener(net.sf.ehcache.store.StoreListener)

removeStoreListener

public void removeStoreListener(StoreListener listener)
Remove listener from store.

Specified by:
removeStoreListener in interface Store
See Also:
Store.removeStoreListener(net.sf.ehcache.store.StoreListener)

fireNodeCoherent

public void fireNodeCoherent(boolean nodeCoherent)
Message to StoreListeners the node's coherence state.


fireClusterCoherent

public void fireClusterCoherent(boolean clusterCoherent)
Message to StoreListeners the cluster's coherence state.


ehcache

true