public abstract class AbstractTransactionStore extends AbstractStore implements TerracottaStore
Modifier and Type | Field and Description |
---|---|
protected Store |
underlyingStore
The underlying store wrapped by this store
|
attributeExtractors, searchManager
CLUSTER_COHERENT, NODE_COHERENT
Modifier | Constructor and Description |
---|---|
protected |
AbstractTransactionStore(Store underlyingStore)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
bufferFull()
Some store types, such as the disk stores can fill their write buffers if puts
come in too fast.
|
boolean |
containsKeyInMemory(Object key)
A check to see if a key is in the Store and is currently held in memory.
|
boolean |
containsKeyOffHeap(Object key)
A check to see if a key is in the Store and is currently held off-heap.
|
boolean |
containsKeyOnDisk(Object key)
A check to see if a key is in the Store and is currently held on disk.
|
WriteBehind |
createWriteBehind()
WriteBehind createWriteBehind |
void |
dispose()
Prepares for shutdown.
|
Results |
executeQuery(StoreQuery query)
Execute the given query on this store
|
void |
expireElements()
Expire all elements.
|
void |
flush()
Flush elements to persistent store.
|
Policy |
getInMemoryEvictionPolicy() |
int |
getInMemorySize()
Returns the current local in-memory store size
|
long |
getInMemorySizeInBytes()
Gets the size of the in-memory portion of the store, in bytes.
|
Object |
getInternalContext()
This should not be used, and will generally return null
|
Set |
getLocalKeys()
Returns set of keys from the cache which are present in the node locally.
|
Object |
getMBean()
Optional implementation specific MBean exposed by the store.
|
int |
getOffHeapSize()
Returns the current local off-heap store size
|
long |
getOffHeapSizeInBytes()
Gets the size of the off-heap portion of the store, in bytes.
|
Element |
getOldElement(Object key)
Method to get to the
Element matching the key, oblivious of any in-flight transaction. |
int |
getOnDiskSize()
Returns the current local on-disk store size
|
long |
getOnDiskSizeInBytes()
Gets the size of the on-disk portion of the store, in bytes.
|
<T> Attribute<T> |
getSearchAttribute(String attributeName)
Retrieve the given named search attribute
|
Set<Attribute> |
getSearchAttributes() |
Status |
getStatus()
Returns the cache status.
|
CacheConfiguration.TransactionalMode |
getTransactionalMode()
Get the transactional mode of this store.
|
boolean |
hasAbortedSizeOf()
Checks if the cache may contain elements for which the SizeOf engine gave up and only
partially calculated the size.
|
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 |
notifyCacheEventListenersChanged()
Notify the underlying store that some change has occured in the set of registered cache listeners.
|
void |
quickClear()
Remove all the contents of the store.
|
int |
quickSize()
Get an approximate count of elements in the store.
|
void |
setAttributeExtractors(Map<String,AttributeExtractor> extractors)
Inform this store of the configured attribute extractors.
|
void |
setInMemoryEvictionPolicy(Policy policy)
Sets the eviction policy strategy.
|
void |
setNodeCoherent(boolean coherent)
Sets the cache in coherent or incoherent mode for the current node depending on the parameter.
|
Element |
unsafeGet(Object key)
Returns the local value associated with the key.
|
void |
waitUntilClusterCoherent()
This method waits until the cache is in coherent mode in all the connected nodes.
|
addStoreListener, getAll, getAllQuiet, getEventListenerList, putAll, recalculateSize, removeAll, removeStoreListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addStoreListener, containsKey, get, getAll, getAllQuiet, getKeys, getQuiet, getSize, getTerracottaClusteredSize, put, putAll, putIfAbsent, putWithWriter, recalculateSize, remove, removeAll, removeAll, removeElement, removeStoreListener, removeWithWriter, replace, replace
protected final Store underlyingStore
protected AbstractTransactionStore(Store underlyingStore)
underlyingStore
- the underlying storepublic Results executeQuery(StoreQuery query)
executeQuery
in interface Store
executeQuery
in class AbstractStore
query
- query to executepublic int getInMemorySize()
getInMemorySize
in interface Store
public int getOffHeapSize()
getOffHeapSize
in interface Store
public int getOnDiskSize()
getOnDiskSize
in interface Store
public long getInMemorySizeInBytes()
getInMemorySizeInBytes
in interface Store
public long getOffHeapSizeInBytes()
getOffHeapSizeInBytes
in interface Store
public long getOnDiskSizeInBytes()
getOnDiskSizeInBytes
in interface Store
public boolean containsKeyOnDisk(Object key)
containsKeyOnDisk
in interface Store
key
- The Element keypublic boolean containsKeyOffHeap(Object key)
containsKeyOffHeap
in interface Store
key
- The Element keypublic boolean containsKeyInMemory(Object key)
containsKeyInMemory
in interface Store
key
- The Element keypublic Status getStatus()
public void expireElements()
expireElements
in interface Store
public void flush() throws IOException
flush
in interface Store
IOException
- if any IO error occurspublic boolean bufferFull()
bufferFull
in interface Store
public Policy getInMemoryEvictionPolicy()
getInMemoryEvictionPolicy
in interface Store
Store.setInMemoryEvictionPolicy(Policy)
public void setInMemoryEvictionPolicy(Policy policy)
setInMemoryEvictionPolicy
in interface Store
policy
- the new policypublic Object getInternalContext()
getInternalContext
in interface Store
public Object getMBean()
public void setNodeCoherent(boolean coherent)
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. TerracottasetNodeCoherent
in interface Store
setNodeCoherent
in class AbstractStore
coherent
- true transitions to coherent mode, false to incoherent modeStore.setNodeCoherent(boolean)
public boolean isNodeCoherent()
isNodeCoherent
in interface Store
isNodeCoherent
in class AbstractStore
Store.isNodeCoherent()
public boolean isCacheCoherent()
Store.isClusterCoherent()
(introduced since 2.0)
Use Store.isNodeCoherent()
to find out if the cache is coherent in the current node in the clusterisCacheCoherent
in interface Store
isCacheCoherent
in class AbstractStore
true
if the store is coherent; or false
if the
store potentially splits the cache storage with another store or
isn't internally coherentStore.isCacheCoherent()
public boolean isClusterCoherent()
isClusterCoherent
in interface Store
isClusterCoherent
in class AbstractStore
Store.isClusterCoherent()
public void waitUntilClusterCoherent() throws TerracottaNotRunningException, UnsupportedOperationException, InterruptedException
waitUntilClusterCoherent
in interface Store
waitUntilClusterCoherent
in class AbstractStore
InterruptedException
UnsupportedOperationException
TerracottaNotRunningException
Store.waitUntilClusterCoherent()
public void setAttributeExtractors(Map<String,AttributeExtractor> extractors)
setAttributeExtractors
in interface Store
setAttributeExtractors
in class AbstractStore
public <T> Attribute<T> getSearchAttribute(String attributeName) throws CacheException
getSearchAttribute
in interface Store
getSearchAttribute
in class AbstractStore
T
- type of the attributeattributeName
- the name of the attribute to retrieveCacheException
public Set<Attribute> getSearchAttributes()
getSearchAttributes
in interface Store
getSearchAttributes
in class AbstractStore
public boolean hasAbortedSizeOf()
hasAbortedSizeOf
in interface Store
hasAbortedSizeOf
in class AbstractStore
public Element unsafeGet(Object key)
unsafeGet
in interface TerracottaStore
key
- the keypublic Set getLocalKeys()
getLocalKeys
in interface TerracottaStore
public CacheConfiguration.TransactionalMode getTransactionalMode()
getTransactionalMode
in interface TerracottaStore
CacheConfiguration.TransactionalMode
public WriteBehind createWriteBehind()
TerracottaStore
WriteBehind
createWriteBehindcreateWriteBehind
in interface TerracottaStore
public void quickClear()
TerracottaStore
quickClear
in interface TerracottaStore
public int quickSize()
TerracottaStore
quickSize
in interface TerracottaStore
public Element getOldElement(Object key)
Element
matching the key, oblivious of any in-flight transaction.key
- the key to look forpublic void notifyCacheEventListenersChanged()
TerracottaStore
notifyCacheEventListenersChanged
in interface TerracottaStore
Copyright © 2003–2016 Terracotta, Inc.. All rights reserved.