org.terracotta.modules.ehcache.store
Class ClusteredStore

java.lang.Object
  extended by org.terracotta.modules.ehcache.store.ClusteredStore
All Implemented Interfaces:
EventListener, Store, StoreListener, TerracottaStore

public class ClusteredStore
extends Object
implements TerracottaStore, StoreListener


Field Summary
protected  ClusteredStoreBackend<String,Serializable> backend
           
protected  Ehcache cache
           
protected  String fullyQualifiedCacheName
           
protected  ToolkitInstanceFactory toolkitInstanceFactory
           
protected  ValueModeHandler valueModeHandler
           
 
Fields inherited from interface net.sf.ehcache.store.Store
CLUSTER_COHERENT, NODE_COHERENT
 
Constructor Summary
ClusteredStore(ToolkitInstanceFactory toolkitInstanceFactory, Ehcache cache, BulkLoadShutdownHook bulkLoadShutdownHook, CacheCluster topology)
           
 
Method Summary
 void addStoreListener(StoreListener listener)
           
 boolean bufferFull()
           
 void clusterCoherent(boolean clusterCoherent)
           
 boolean containsKey(Object key)
           
 boolean containsKeyInMemory(Object key)
           
 boolean containsKeyOffHeap(Object key)
           
 boolean containsKeyOnDisk(Object key)
           
 WriteBehind createWriteBehind()
           
 void dispose()
           
 Results executeQuery(StoreQuery query)
           
 void expireElements()
          Expire all elements.
 void flush()
           
 String generatePortableKeyFor(Object obj)
          Generates a portable key for the supplied object.
 Element get(Object key)
           
 Map<Object,Element> getAll(Collection<?> keys)
           
 Map<Object,Element> getAllQuiet(Collection<?> keys)
           
 String getFullyQualifiedCacheName()
           
 Policy getInMemoryEvictionPolicy()
           
 int getInMemorySize()
           
 long getInMemorySizeInBytes()
           
 Object getInternalContext()
           
 List getKeys()
           
 String getLeader()
           
 Set getLocalKeys()
           
 Object getMBean()
           
 int getOffHeapSize()
           
 long getOffHeapSizeInBytes()
           
 int getOnDiskSize()
           
 long getOnDiskSizeInBytes()
           
 Element getQuiet(Object key)
           
<T> Attribute<T>
getSearchAttribute(String attributeName)
           
 int getSize()
           
 Status getStatus()
           
 int getTerracottaClusteredSize()
           
 CacheConfiguration.TransactionalMode getTransactionalMode()
           
 boolean hasAbortedSizeOf()
           
 boolean isCacheCoherent()
           
 boolean isClusterCoherent()
           
 boolean isNodeCoherent()
           
 boolean isSearchable()
           
 boolean isThisNodeLeader()
           
 boolean put(Element element)
           
 void putAll(Collection<Element> elements)
           
 Element putIfAbsent(Element element)
           
 boolean putWithWriter(Element element, CacheWriterManager writerManager)
           
 void recalculateSize(Object key)
           
 Element remove(Object key)
           
 void removeAll()
           
 void removeAll(Collection<?> keys)
           
 Element removeElement(Element element, ElementValueComparator comparator)
           
 void removeStoreListener(StoreListener listener)
           
 Element removeWithWriter(Object key, CacheWriterManager writerManager)
           
 Element replace(Element element)
           
 boolean replace(Element old, Element element, ElementValueComparator comparator)
           
 void setAttributeExtractors(Map<String,AttributeExtractor> extractors)
           
 void setInMemoryEvictionPolicy(Policy policy)
           
 void setNodeCoherent(boolean coherent)
           
 Element unsafeGet(Object key)
           
 void waitUntilClusterCoherent()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

backend

protected final ClusteredStoreBackend<String,Serializable> backend

valueModeHandler

protected final ValueModeHandler valueModeHandler

toolkitInstanceFactory

protected final ToolkitInstanceFactory toolkitInstanceFactory

cache

protected final Ehcache cache

fullyQualifiedCacheName

protected final String fullyQualifiedCacheName
Constructor Detail

ClusteredStore

public ClusteredStore(ToolkitInstanceFactory toolkitInstanceFactory,
                      Ehcache cache,
                      BulkLoadShutdownHook bulkLoadShutdownHook,
                      CacheCluster topology)
Method Detail

getFullyQualifiedCacheName

public String getFullyQualifiedCacheName()

recalculateSize

public void recalculateSize(Object key)
Specified by:
recalculateSize in interface Store

addStoreListener

public void addStoreListener(StoreListener listener)
Specified by:
addStoreListener in interface Store

removeStoreListener

public void removeStoreListener(StoreListener listener)
Specified by:
removeStoreListener in interface Store

clusterCoherent

public void clusterCoherent(boolean clusterCoherent)
Specified by:
clusterCoherent in interface StoreListener

put

public boolean put(Element element)
            throws CacheException
Specified by:
put in interface Store
Throws:
CacheException

putWithWriter

public boolean putWithWriter(Element element,
                             CacheWriterManager writerManager)
                      throws CacheException
Specified by:
putWithWriter in interface Store
Throws:
CacheException

putAll

public void putAll(Collection<Element> elements)
            throws CacheException
Specified by:
putAll in interface Store
Throws:
CacheException

get

public Element get(Object key)
Specified by:
get in interface Store

getQuiet

public Element getQuiet(Object key)
Specified by:
getQuiet in interface Store

getKeys

public List getKeys()
Specified by:
getKeys in interface Store

remove

public Element remove(Object key)
Specified by:
remove in interface Store

removeAll

public void removeAll(Collection<?> keys)
Specified by:
removeAll in interface Store

removeWithWriter

public Element removeWithWriter(Object key,
                                CacheWriterManager writerManager)
                         throws CacheException
Specified by:
removeWithWriter in interface Store
Throws:
CacheException

removeAll

public void removeAll()
               throws CacheException
Specified by:
removeAll in interface Store
Throws:
CacheException

putIfAbsent

public Element putIfAbsent(Element element)
                    throws NullPointerException
Specified by:
putIfAbsent in interface Store
Throws:
NullPointerException

removeElement

public Element removeElement(Element element,
                             ElementValueComparator comparator)
                      throws NullPointerException
Specified by:
removeElement in interface Store
Throws:
NullPointerException

replace

public boolean replace(Element old,
                       Element element,
                       ElementValueComparator comparator)
                throws NullPointerException,
                       IllegalArgumentException
Specified by:
replace in interface Store
Throws:
NullPointerException
IllegalArgumentException

replace

public Element replace(Element element)
                throws NullPointerException
Specified by:
replace in interface Store
Throws:
NullPointerException

dispose

public void dispose()
Specified by:
dispose in interface Store

getSize

public int getSize()
Specified by:
getSize in interface Store

getInMemorySize

public int getInMemorySize()
Specified by:
getInMemorySize in interface Store

getOffHeapSize

public int getOffHeapSize()
Specified by:
getOffHeapSize in interface Store

getOnDiskSize

public int getOnDiskSize()
Specified by:
getOnDiskSize in interface Store

getTerracottaClusteredSize

public int getTerracottaClusteredSize()
Specified by:
getTerracottaClusteredSize in interface Store

getInMemorySizeInBytes

public long getInMemorySizeInBytes()
Specified by:
getInMemorySizeInBytes in interface Store

getOffHeapSizeInBytes

public long getOffHeapSizeInBytes()
Specified by:
getOffHeapSizeInBytes in interface Store

getOnDiskSizeInBytes

public long getOnDiskSizeInBytes()
Specified by:
getOnDiskSizeInBytes in interface Store

hasAbortedSizeOf

public boolean hasAbortedSizeOf()
Specified by:
hasAbortedSizeOf in interface Store

getStatus

public Status getStatus()
Specified by:
getStatus in interface Store

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Store

containsKeyOnDisk

public boolean containsKeyOnDisk(Object key)
Specified by:
containsKeyOnDisk in interface Store

containsKeyOffHeap

public boolean containsKeyOffHeap(Object key)
Specified by:
containsKeyOffHeap in interface Store

containsKeyInMemory

public boolean containsKeyInMemory(Object key)
Specified by:
containsKeyInMemory in interface Store

expireElements

public void expireElements()
Expire all elements.

This is a default implementation which does nothing. Expiration on demand is only implemented for disk stores.

Specified by:
expireElements in interface Store

flush

public void flush()
Specified by:
flush in interface Store

bufferFull

public boolean bufferFull()
Specified by:
bufferFull in interface Store

getInMemoryEvictionPolicy

public Policy getInMemoryEvictionPolicy()
Specified by:
getInMemoryEvictionPolicy in interface Store

setInMemoryEvictionPolicy

public void setInMemoryEvictionPolicy(Policy policy)
Specified by:
setInMemoryEvictionPolicy in interface Store

getInternalContext

public Object getInternalContext()
Specified by:
getInternalContext in interface Store

isCacheCoherent

public boolean isCacheCoherent()
Specified by:
isCacheCoherent in interface Store

isClusterCoherent

public boolean isClusterCoherent()
                          throws TerracottaNotRunningException
Specified by:
isClusterCoherent in interface Store
Throws:
TerracottaNotRunningException

isNodeCoherent

public boolean isNodeCoherent()
                       throws TerracottaNotRunningException
Specified by:
isNodeCoherent in interface Store
Throws:
TerracottaNotRunningException

setNodeCoherent

public void setNodeCoherent(boolean coherent)
                     throws UnsupportedOperationException,
                            TerracottaNotRunningException
Specified by:
setNodeCoherent in interface Store
Throws:
UnsupportedOperationException
TerracottaNotRunningException

waitUntilClusterCoherent

public void waitUntilClusterCoherent()
                              throws UnsupportedOperationException,
                                     TerracottaNotRunningException,
                                     InterruptedException
Specified by:
waitUntilClusterCoherent in interface Store
Throws:
UnsupportedOperationException
TerracottaNotRunningException
InterruptedException

getMBean

public Object getMBean()
Specified by:
getMBean in interface Store

setAttributeExtractors

public void setAttributeExtractors(Map<String,AttributeExtractor> extractors)
Specified by:
setAttributeExtractors in interface Store

executeQuery

public Results executeQuery(StoreQuery query)
                     throws SearchException
Specified by:
executeQuery in interface Store
Throws:
SearchException

getSearchAttribute

public <T> Attribute<T> getSearchAttribute(String attributeName)
Specified by:
getSearchAttribute in interface Store

getAllQuiet

public Map<Object,Element> getAllQuiet(Collection<?> keys)
Specified by:
getAllQuiet in interface Store

getAll

public Map<Object,Element> getAll(Collection<?> keys)
Specified by:
getAll in interface Store

generatePortableKeyFor

public String generatePortableKeyFor(Object obj)
Generates a portable key for the supplied object.


unsafeGet

public Element unsafeGet(Object key)
Specified by:
unsafeGet in interface TerracottaStore

getLocalKeys

public Set getLocalKeys()
Specified by:
getLocalKeys in interface TerracottaStore

getTransactionalMode

public CacheConfiguration.TransactionalMode getTransactionalMode()
Specified by:
getTransactionalMode in interface TerracottaStore

isSearchable

public boolean isSearchable()

getLeader

public String getLeader()

isThisNodeLeader

public boolean isThisNodeLeader()

createWriteBehind

public WriteBehind createWriteBehind()
Specified by:
createWriteBehind in interface TerracottaStore


Copyright © 2003-2013 Terracotta, Inc.. All Rights Reserved.