public class XATransactionStore extends AbstractTransactionStore
Modifier and Type | Class and Description |
---|---|
private class |
XATransactionStore.CleanupTimeout
This class is used to clean up the transactionToTimeoutMap after a transaction
committed or rolled back.
|
private class |
XATransactionStore.CleanupXAResource
This class is used to clean up the transactionToXAResourceMap after a transaction
committed or rolled back.
|
private class |
XATransactionStore.UnregisterXAResource
This class is used to unregister the XAResource after a transaction
committed or rolled back.
|
Modifier and Type | Field and Description |
---|---|
private Ehcache |
cache |
private static org.slf4j.Logger |
LOG |
private SoftLockManager |
softLockManager |
private TransactionIDFactory |
transactionIdFactory |
private TransactionManagerLookup |
transactionManagerLookup |
private java.util.concurrent.ConcurrentHashMap<javax.transaction.Transaction,java.lang.Long> |
transactionToTimeoutMap |
private java.util.concurrent.ConcurrentHashMap<javax.transaction.Transaction,EhcacheXAResource> |
transactionToXAResourceMap |
copyStrategy, underlyingStore
attributeExtractors
CLUSTER_COHERENT, NODE_COHERENT
Constructor and Description |
---|
XATransactionStore(TransactionManagerLookup transactionManagerLookup,
SoftLockManager softLockManager,
TransactionIDFactory transactionIdFactory,
Ehcache cache,
Store store,
ReadWriteCopyStrategy<Element> copyStrategy)
Constructor
|
Modifier and Type | Method and Description |
---|---|
private long |
assertNotTimedOut() |
boolean |
containsKey(java.lang.Object key)
A check to see if a key is in the Store.
|
Element |
get(java.lang.Object key)
Gets an item from the cache.
|
private Element |
getCurrentElement(java.lang.Object key,
XATransactionContext context) |
private javax.transaction.Transaction |
getCurrentTransaction() |
private Element |
getFromUnderlyingStore(java.lang.Object key) |
java.util.List |
getKeys()
Gets an Array of the keys for all elements in the disk store.
|
private XATransactionContext |
getOrCreateTransactionContext() |
EhcacheXAResourceImpl |
getOrCreateXAResource()
Get or create the XAResource of this XA store
|
Element |
getQuiet(java.lang.Object key)
Gets an
Element from the Store, without updating statistics |
private Element |
getQuietFromUnderlyingStore(java.lang.Object key) |
int |
getSize()
Returns the current local store size
|
int |
getTerracottaClusteredSize()
Returns the current Terracotta clustered store size
|
private XATransactionContext |
getTransactionContext() |
private boolean |
internalPut(StorePutCommand putCommand) |
boolean |
put(Element element)
Puts an item into the store.
|
Element |
putIfAbsent(Element element)
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
|
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 element,
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.
|
private Element |
removeInternal(StoreRemoveCommand command) |
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 element)
Replace the cached element only if an Element is currently cached for this key
|
boolean |
replace(Element old,
Element element,
ElementValueComparator comparator)
Replace the cached element only if the value of the current Element is equal to the value of the
supplied old Element.
|
void |
setAttributeExtractors(java.util.Map<java.lang.String,AttributeExtractor> extractors)
Inform this store of the configured attribute extractors.
|
bufferFull, containsKeyInMemory, containsKeyOffHeap, containsKeyOnDisk, copyElementForRead, copyElementForWrite, dispose, 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 TransactionManagerLookup transactionManagerLookup
private final TransactionIDFactory transactionIdFactory
private final SoftLockManager softLockManager
private final Ehcache cache
private final java.util.concurrent.ConcurrentHashMap<javax.transaction.Transaction,EhcacheXAResource> transactionToXAResourceMap
private final java.util.concurrent.ConcurrentHashMap<javax.transaction.Transaction,java.lang.Long> transactionToTimeoutMap
public XATransactionStore(TransactionManagerLookup transactionManagerLookup, SoftLockManager softLockManager, TransactionIDFactory transactionIdFactory, Ehcache cache, Store store, ReadWriteCopyStrategy<Element> copyStrategy)
transactionManagerLookup
- the transaction manager lookup implementationsoftLockManager
- the soft lock managertransactionIdFactory
- the transaction ID factorycache
- the cachestore
- the underlying storecopyStrategy
- the original copy strategyprivate javax.transaction.Transaction getCurrentTransaction() throws javax.transaction.SystemException
javax.transaction.SystemException
public EhcacheXAResourceImpl getOrCreateXAResource() throws javax.transaction.SystemException
javax.transaction.SystemException
- when something goes wrong with the transaction managerprivate XATransactionContext getTransactionContext()
private XATransactionContext getOrCreateTransactionContext()
private long assertNotTimedOut()
public Element get(java.lang.Object key)
public Element getQuiet(java.lang.Object key)
Element
from the Store, without updating statisticspublic int getSize()
public int getTerracottaClusteredSize()
public boolean containsKey(java.lang.Object key)
key
- The Element keypublic java.util.List getKeys()
Serializable
keysprivate Element getFromUnderlyingStore(java.lang.Object key)
private Element getQuietFromUnderlyingStore(java.lang.Object key)
private Element getCurrentElement(java.lang.Object key, XATransactionContext context)
public boolean put(Element element) throws CacheException
CacheException
public boolean putWithWriter(Element element, CacheWriterManager writerManager) throws CacheException
CacheException
private boolean internalPut(StorePutCommand putCommand)
public Element remove(java.lang.Object key)
private Element removeInternal(StoreRemoveCommand command)
public Element removeWithWriter(java.lang.Object key, CacheWriterManager writerManager) throws CacheException
CacheException
public void removeAll() throws CacheException
CacheEventListener
s they are notified of the expiry or removal
of the Element
as each is removed.CacheException
public Element putIfAbsent(Element element) throws java.lang.NullPointerException
element
- element to be addedjava.lang.NullPointerException
- if the element is null, or has a null keypublic Element removeElement(Element element, ElementValueComparator comparator) throws java.lang.NullPointerException
element
- 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 old, Element element, ElementValueComparator comparator) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
old
- Element to be test againstelement
- 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 element) throws java.lang.NullPointerException
element
- Element to be cachedjava.lang.NullPointerException
- if the Element is null or has a null keypublic void setAttributeExtractors(java.util.Map<java.lang.String,AttributeExtractor> extractors)
setAttributeExtractors
in interface Store
setAttributeExtractors
in class AbstractTransactionStore