|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.ehcache.store.AbstractStore
net.sf.ehcache.store.XATransactionalStore
public class XATransactionalStore
A transaction aware store that wraps the actual Store. It will provide proper READ_COMMITED transaction isolation. It does so by queuing write operations on the cache. These will eventually be executed at transaction commit time, or discarded in case of rollback.
Field Summary |
---|
Fields inherited from interface net.sf.ehcache.store.Store |
---|
CLUSTER_COHERENT, NODE_COHERENT |
Constructor Summary | |
---|---|
XATransactionalStore(Ehcache cache,
EhcacheXAStore ehcacheXAStore,
TransactionManagerLookup transactionManagerLookup,
javax.transaction.TransactionManager txnManager)
Create a store which will wrap another one to provide XA transactions. |
Method Summary | |
---|---|
boolean |
bufferFull()
Non transactional Some store types, such as the disk stores can fill their write buffers if puts come in too fast. |
boolean |
containsKey(java.lang.Object key)
A check to see if a key is in the Store. |
boolean |
containsKeyInMemory(java.lang.Object key)
A check to see if a key is in the Store and is currently held in memory. |
boolean |
containsKeyOffHeap(java.lang.Object key)
A check to see if a key is in the Store and is currently held off-heap. |
boolean |
containsKeyOnDisk(java.lang.Object key)
A check to see if a key is in the Store and is currently held on disk. |
void |
dispose()
Non transactional |
void |
expireElements()
Non transactional Expire all elements. |
void |
flush()
Non transactional Flush elements to persistent store. |
Element |
get(java.lang.Object key)
Gets an item from the cache. |
Policy |
getInMemoryEvictionPolicy()
Non transactional |
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. |
java.lang.Object |
getInternalContext()
Non transactional This should not be used, and will generally return null |
java.util.List |
getKeys()
Gets an Array of the keys for all elements in the disk store. |
java.lang.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. |
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. |
EhcacheXAResource |
getOrCreateXAResource()
This method either returns the XAResource associated with the current transaction or creates a new one if there was none yet. |
Element |
getQuiet(java.lang.Object key)
Gets an Element from the Store, without updating statistics |
int |
getSize()
TransactionContext impacted size of the store |
Status |
getStatus()
Non transactional |
int |
getTerracottaClusteredSize()
Returns the current Terracotta clustered store size |
boolean |
isCacheCoherent()
Non transactional 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. |
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)
XATransactionalStore to put including to the underlying data store. |
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)
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)
XATransactionalStore to remove including from the underlying data store. |
Element |
replace(Element element)
Replace the cached element only if an Element is currently cached for this key |
boolean |
replace(Element old,
Element element)
Replace the cached element only if the value of the current Element is equal to the value of the supplied old Element. |
void |
setInMemoryEvictionPolicy(Policy policy)
Non transactional 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. |
void |
waitUntilClusterCoherent()
This method waits until the cache is in coherent mode in all the connected nodes. |
Methods inherited from class net.sf.ehcache.store.AbstractStore |
---|
addStoreListener, fireClusterCoherent, fireNodeCoherent, getEventListenerList, removeStoreListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XATransactionalStore(Ehcache cache, EhcacheXAStore ehcacheXAStore, TransactionManagerLookup transactionManagerLookup, javax.transaction.TransactionManager txnManager)
cache
- the cache this store is backingehcacheXAStore
- the XAStore to be used by this storetransactionManagerLookup
- the TransactionManagerLookup used to get hold of the JTA transaction managertxnManager
- Method Detail |
---|
public boolean put(Element element) throws CacheException
CacheException
public boolean putWithWriter(Element element, CacheWriterManager writerManager) throws CacheException
CacheWriterManager.put(net.sf.ehcache.Element)
will be held back
until commit time!
element
- the element to add to the storewriterManager
- will only work properly with WriteThroughManager
CacheException
public Element get(java.lang.Object key)
public Element getQuiet(java.lang.Object key)
Element
from the Store, without updating statistics
public final java.util.List getKeys()
Serializable
keyspublic Element remove(java.lang.Object key)
public Element removeWithWriter(java.lang.Object key, CacheWriterManager writerManager) throws CacheException
CacheWriterManager.remove(net.sf.ehcache.CacheEntry)
will be not held back
until commit time!
key
- the key to removewriterManager
- will only work properly with WriteThroughManager
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 void dispose()
Prepares for shutdown.
public int getSize()
public int getOnDiskSize()
public int getOffHeapSize()
public int getInMemorySize()
public int getTerracottaClusteredSize()
public long getInMemorySizeInBytes()
public long getOffHeapSizeInBytes()
public long getOnDiskSizeInBytes()
public Status getStatus()
Returns the cache status.
public boolean containsKey(java.lang.Object key)
key
- The Element key
public boolean containsKeyInMemory(java.lang.Object key)
key
- The Element key
public boolean containsKeyOffHeap(java.lang.Object key)
key
- The Element key
public boolean containsKeyOnDisk(java.lang.Object key)
key
- The Element key
public void expireElements()
public void flush() throws java.io.IOException
java.io.IOException
- if any IO error occurspublic boolean bufferFull()
public Policy getInMemoryEvictionPolicy()
Store.setInMemoryEvictionPolicy(Policy)
public void setInMemoryEvictionPolicy(Policy policy)
policy
- the new policypublic java.lang.Object getInternalContext()
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 cluster
isCacheCoherent
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 boolean isNodeCoherent()
isNodeCoherent
in interface Store
isNodeCoherent
in class AbstractStore
Store.isNodeCoherent()
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. Terracotta
setNodeCoherent
in interface Store
setNodeCoherent
in class AbstractStore
coherent
- true transitions to coherent mode, false to incoherent modeStore.setNodeCoherent(boolean)
public void waitUntilClusterCoherent()
waitUntilClusterCoherent
in interface Store
waitUntilClusterCoherent
in class AbstractStore
Store.waitUntilClusterCoherent()
public Element putIfAbsent(Element element) throws java.lang.NullPointerException
element
- element to be added
java.lang.NullPointerException
- if the element is null, or has a null keypublic Element removeElement(Element element) throws java.lang.NullPointerException
element
- Element to be removed
java.lang.NullPointerException
- if the element is null, or has a null keypublic boolean replace(Element old, Element element) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
old
- Element to be test againstelement
- Element to be cached
java.lang.NullPointerException
- if the either Element is null or has a null key
java.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 cached
java.lang.NullPointerException
- if the Element is null or has a null keypublic EhcacheXAResource getOrCreateXAResource()
public java.lang.Object getMBean()
|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |