public class LocalTransactionStore extends AbstractTransactionStore
Modifier and Type | Field and Description |
---|---|
private Ehcache |
cache |
private java.lang.String |
cacheName |
private ElementValueComparator |
comparator |
private static org.slf4j.Logger |
LOG |
private SoftLockManager |
softLockManager |
private TransactionController |
transactionController |
private TransactionIDFactory |
transactionIdFactory |
copyStrategy, underlyingStore
attributeExtractors
CLUSTER_COHERENT, NODE_COHERENT
Constructor and Description |
---|
LocalTransactionStore(TransactionController transactionController,
TransactionIDFactory transactionIdFactory,
SoftLockManager softLockManager,
Ehcache cache,
Store store,
ReadWriteCopyStrategy<Element> copyStrategy)
Create a new LocalTransactionStore instance
|
Modifier and Type | Method and Description |
---|---|
private void |
assertNotTimedOut() |
private void |
assertNotTimedOut(java.lang.Object key,
boolean wasPinned) |
private boolean |
cleanupExpiredSoftLock(Element oldElement,
SoftLockID softLockId) |
(package private) void |
commit(java.util.List<SoftLock> softLocks)
Commit work of the specified soft locks
|
boolean |
containsKey(java.lang.Object key)
A check to see if a key is in the Store.
|
private Element |
createElement(java.lang.Object key,
SoftLockID softLockId,
boolean isPinned) |
void |
dispose()
Prepares for shutdown.
|
Element |
get(java.lang.Object key)
Gets an item from the cache.
|
(package private) Ehcache |
getCache()
Get the cache using this store
|
private LocalTransactionContext |
getCurrentTransactionContext() |
java.util.List |
getKeys()
Gets an Array of the keys for all elements in the disk store.
|
Element |
getQuiet(java.lang.Object key)
Gets an
Element from the Store, without updating statistics |
int |
getSize()
Returns the current local store size
|
int |
getTerracottaClusteredSize()
Returns the current Terracotta clustered store size
|
boolean |
put(Element e)
Puts an item into the store.
|
Element |
putIfAbsent(Element e)
Put an element in the store if no element is currently mapped to the elements key.
|
boolean |
putWithWriter(Element element,
CacheWriterManager writerManager)
Puts an item into the store and the cache writer manager in an atomic operation
|
java.util.Set<TransactionID> |
recover()
Recover and resolve all known soft locks
|
Element |
remove(java.lang.Object key)
Removes an item from the cache.
|
void |
removeAll()
Remove all of the elements from the store.
|
Element |
removeElement(Element e,
ElementValueComparator comparator)
Remove the Element mapped to the key for the supplied element if the value of the supplied Element
is equal to the value of the cached Element.
|
Element |
removeWithWriter(java.lang.Object key,
CacheWriterManager writerManager)
Removes an item from the store and the cache writer manager in an atomic operation.
|
Element |
replace(Element e)
Replace the cached element only if an Element is currently cached for this key
|
boolean |
replace(Element oe,
Element ne,
ElementValueComparator comparator)
Replace the cached element only if the value of the current Element is equal to the value of the
supplied old Element.
|
(package private) void |
rollback(java.util.List<SoftLock> softLocks)
Rollback work of the specified soft locks
|
void |
setAttributeExtractors(java.util.Map<java.lang.String,AttributeExtractor> extractors)
Inform this store of the configured attribute extractors.
|
private long |
timeBeforeTimeout() |
bufferFull, containsKeyInMemory, containsKeyOffHeap, containsKeyOnDisk, copyElementForRead, copyElementForWrite, executeQuery, expireElements, flush, getInMemoryEvictionPolicy, getInMemorySize, getInMemorySizeInBytes, getInternalContext, getLocalKeys, getMBean, getOffHeapSize, getOffHeapSizeInBytes, getOnDiskSize, getOnDiskSizeInBytes, getSearchAttribute, getStatus, getTransactionalMode, hasAbortedSizeOf, isCacheCoherent, isClusterCoherent, isNodeCoherent, isPinned, setInMemoryEvictionPolicy, setNodeCoherent, setPinned, unlockedGet, unlockedGetQuiet, unpinAll, unsafeGet, unsafeGetQuiet, waitUntilClusterCoherent
addStoreListener, getAll, getAllQuiet, getEventListenerList, putAll, recalculateSize, removeAll, removeStoreListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addStoreListener, getAll, getAllQuiet, putAll, recalculateSize, removeAll, removeStoreListener
private static final org.slf4j.Logger LOG
private final TransactionController transactionController
private final TransactionIDFactory transactionIdFactory
private final SoftLockManager softLockManager
private final Ehcache cache
private final java.lang.String cacheName
private final ElementValueComparator comparator
public LocalTransactionStore(TransactionController transactionController, TransactionIDFactory transactionIdFactory, SoftLockManager softLockManager, Ehcache cache, Store store, ReadWriteCopyStrategy<Element> copyStrategy)
transactionController
- the TransactionControllersoftLockManager
- the SoftLockManagercache
- the cachestore
- the underlying storecopyStrategy
- the configured CopyStrategypublic void dispose()
AbstractTransactionStore
dispose
in interface Store
dispose
in class AbstractTransactionStore
Ehcache getCache()
private LocalTransactionContext getCurrentTransactionContext()
private void assertNotTimedOut(java.lang.Object key, boolean wasPinned)
private void assertNotTimedOut()
private long timeBeforeTimeout()
private Element createElement(java.lang.Object key, SoftLockID softLockId, boolean isPinned)
private boolean cleanupExpiredSoftLock(Element oldElement, SoftLockID softLockId)
public java.util.Set<TransactionID> recover()
public boolean put(Element e) throws CacheException
CacheException
public Element getQuiet(java.lang.Object key)
Element
from the Store, without updating statisticspublic Element get(java.lang.Object key)
public Element remove(java.lang.Object key)
public java.util.List getKeys()
Serializable
keyspublic int getSize()
public int getTerracottaClusteredSize()
public boolean containsKey(java.lang.Object key)
key
- The Element keypublic void removeAll() throws CacheException
CacheEventListener
s they are notified of the expiry or removal
of the Element
as each is removed.CacheException
public boolean putWithWriter(Element element, CacheWriterManager writerManager) throws CacheException
CacheException
public Element removeWithWriter(java.lang.Object key, CacheWriterManager writerManager) throws CacheException
CacheException
public Element putIfAbsent(Element e) throws java.lang.NullPointerException
e
- element to be addedjava.lang.NullPointerException
- if the element is null, or has a null keypublic Element removeElement(Element e, ElementValueComparator comparator) throws java.lang.NullPointerException
e
- Element to be removedcomparator
- ElementValueComparator to use to compare elementsjava.lang.NullPointerException
- if the element is null, or has a null keypublic boolean replace(Element oe, Element ne, ElementValueComparator comparator) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
oe
- Element to be test againstne
- Element to be cachedcomparator
- ElementValueComparator to use to compare elementsjava.lang.NullPointerException
- if the either Element is null or has a null keyjava.lang.IllegalArgumentException
- if the two Element keys are non-null but not equalpublic Element replace(Element e) throws java.lang.NullPointerException
e
- Element to be cachedjava.lang.NullPointerException
- if the Element is null or has a null keyvoid commit(java.util.List<SoftLock> softLocks)
softLocks
- the soft locks to commitvoid rollback(java.util.List<SoftLock> softLocks)
softLocks
- the soft locks to rollbackpublic void setAttributeExtractors(java.util.Map<java.lang.String,AttributeExtractor> extractors)
setAttributeExtractors
in interface Store
setAttributeExtractors
in class AbstractTransactionStore