org.codehaus.activespace.cache
Class TransactionalCache
java.lang.Object
org.codehaus.activespace.cache.impl.CacheFacade
org.codehaus.activespace.cache.TransactionalCache
- All Implemented Interfaces:
- javax.cache.Cache, Map
- Direct Known Subclasses:
- ClusteredCache
- public class TransactionalCache
- extends CacheFacade
TransactionalCache can be used by multiple threads concurrently
and it will maintain a thread local transactional view of an underlying
shared cache, tracking changes to the underlying cache,
yet not applying them until a transaction commits.
This allows many threads to concurrently modify the same cache concurrently
and transactionally.
- Version:
- $Revision: 1.14 $
| Methods inherited from class org.codehaus.activespace.cache.impl.CacheFacade |
addListener, clear, containsKey, containsValue, entrySet, evict, get, getAll, getCacheEntry, getCacheStatistics, isEmpty, keySet, load, loadAll, peek, put, putAll, remove, removeListener, size, values |
| Methods inherited from interface javax.cache.Cache |
equals, hashCode |
TransactionalCache
public TransactionalCache(javax.cache.Cache backingCache)
toString
public String toString()
getName
public String getName()
setName
public void setName(String name)
getBackingCache
public javax.cache.Cache getBackingCache()
createTransactionCommand
public TransactionalCacheCommand createTransactionCommand()
resetLocalChanges
public void resetLocalChanges()
isModifiedInTransaction
public boolean isModifiedInTransaction()
getThreadCache
public ThreadCache getThreadCache()
getThreadCache
public ThreadCache getThreadCache(String originator)
- Returns the ThreadCache which is currently processing a transaction
or null if no such local ThreadCache exists for the given ID
getTransactionRegistration
public TransactionRegistration getTransactionRegistration()
setTransactionRegistration
public void setTransactionRegistration(TransactionRegistration transactionRegistration)
setThreadID
public void setThreadID(String id)
- A helper method used for testing, which allows the ID for a thread's cache to
be explicitly configured rather than being randomly generated, which can make debugging
easier.
getDelegate
protected javax.cache.Cache getDelegate()
- Specified by:
getDelegate in class CacheFacade
createThreadState
protected TransactionalCache.ThreadLocalState createThreadState(String id)
createCacheForCurrentThread
protected ThreadCache createCacheForCurrentThread(TransactionalCache.ThreadLocalState state)
getThreadState
protected TransactionalCache.ThreadLocalState getThreadState()
clearThreadState
protected void clearThreadState(TransactionalCache.ThreadLocalState state)
registerCacheWithTransactionManager
protected void registerCacheWithTransactionManager(TransactionalCache.ThreadLocalState state)
- A hook to allow us to register the cache with the current transaction if one is in progress
or start one if one is not.
Copyright © 2004 Protique, Ltd.. All Rights Reserved.