|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.ehcache.transaction.xa.EhcacheXAStoreImpl
public class EhcacheXAStoreImpl
Default implementation of EhcacheXAStore
.
It uses ConcurrentHashMap
for the local data (non safe in case of failure) and requires
a "safe" Store
for the oldVersionStore, and a reference to the underlying Store.
Nested Class Summary | |
---|---|
static class |
EhcacheXAStoreImpl.Version
Represents an Element's version for a Store |
static class |
EhcacheXAStoreImpl.VersionTable
A table containing element version information |
Field Summary | |
---|---|
protected Store |
oldVersionStore
protected for testing |
protected java.util.concurrent.ConcurrentMap<javax.transaction.xa.Xid,PreparedContext> |
prepareXids
protected for testing |
protected java.util.concurrent.ConcurrentMap<javax.transaction.xa.Xid,XATransactionContext> |
transactionContextXids
protected for testing |
protected Store |
underlyingStore
protected for testing |
protected EhcacheXAStoreImpl.VersionTable |
versionTable
protected for testing |
Constructor Summary | |
---|---|
EhcacheXAStoreImpl(Store underlyingStore,
Store oldVersionStore)
Constructor |
Method Summary | |
---|---|
void |
checkin(java.lang.Object key,
javax.transaction.xa.Xid xid,
boolean readOnly)
Checks in changes to a key |
long |
checkout(java.lang.Object key,
javax.transaction.xa.Xid xid)
Checks a version for en Element out of the store |
PreparedContext |
createPreparedContext()
Return a newly created prepare context if none exist. |
TransactionContext |
createTransactionContext(javax.transaction.xa.Xid xid)
Creates a new TransactionContext for a given Transaction |
Store |
getOldVersionStore()
Getter to the guarding read-only oldVersionStore |
PreparedContext |
getPreparedContext(javax.transaction.xa.Xid xid)
Gets a PreparedContext from a persistent store for a previously prepared Transaction |
javax.transaction.xa.Xid[] |
getPreparedXids()
Lists prepared, yet not commited Xids |
TransactionContext |
getTransactionContext(javax.transaction.xa.Xid xid)
Gets a stored TransactionContext for a given Transaction |
Store |
getUnderlyingStore()
Getter to the underlying store |
boolean |
isPrepared(javax.transaction.xa.Xid xid)
Checks whether a Transaction is prepared |
boolean |
isValid(VersionAwareCommand command,
javax.transaction.xa.Xid xid)
Checks whether a command can safely be executed against the store, depending on the version lock |
void |
prepare(javax.transaction.xa.Xid xid,
PreparedContext context)
Save the Transaction's data as being prepared |
void |
removeData(javax.transaction.xa.Xid xid)
Removes stored data of a given Xid |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.util.concurrent.ConcurrentMap<javax.transaction.xa.Xid,XATransactionContext> transactionContextXids
protected final java.util.concurrent.ConcurrentMap<javax.transaction.xa.Xid,PreparedContext> prepareXids
protected final EhcacheXAStoreImpl.VersionTable versionTable
protected Store underlyingStore
protected Store oldVersionStore
Constructor Detail |
---|
public EhcacheXAStoreImpl(Store underlyingStore, Store oldVersionStore)
underlyingStore
- the real underlying storeoldVersionStore
- the old version, read-only, used to access keys during 2pcMethod Detail |
---|
public Store getOldVersionStore()
getOldVersionStore
in interface EhcacheXAStore
public boolean isPrepared(javax.transaction.xa.Xid xid)
isPrepared
in interface EhcacheXAStore
xid
- the Xid of the Transaction
public void removeData(javax.transaction.xa.Xid xid)
removeData
in interface EhcacheXAStore
xid
- the Xid of the Transactionpublic void checkin(java.lang.Object key, javax.transaction.xa.Xid xid, boolean readOnly)
checkin
in interface EhcacheXAStore
key
- the key of the affected Element in the Storexid
- the Xid of the Transaction executing the changereadOnly
- whether the command modified the underlying Storepublic long checkout(java.lang.Object key, javax.transaction.xa.Xid xid)
checkout
in interface EhcacheXAStore
key
- the key to the Element in the storexid
- the Xid of the Transaction reading
public TransactionContext createTransactionContext(javax.transaction.xa.Xid xid)
createTransactionContext
in interface EhcacheXAStore
xid
- of current transaction
public javax.transaction.xa.Xid[] getPreparedXids()
getPreparedXids
in interface EhcacheXAStore
public TransactionContext getTransactionContext(javax.transaction.xa.Xid xid)
getTransactionContext
in interface EhcacheXAStore
xid
- The Xid of the Transaction
public boolean isValid(VersionAwareCommand command, javax.transaction.xa.Xid xid)
isValid
in interface EhcacheXAStore
command
- the Command
public void prepare(javax.transaction.xa.Xid xid, PreparedContext context)
prepare
in interface EhcacheXAStore
xid
- the Xid of the Transactioncontext
- the context with the transaction datapublic PreparedContext getPreparedContext(javax.transaction.xa.Xid xid)
getPreparedContext
in interface EhcacheXAStore
xid
- The Xid of the Transaction
public PreparedContext createPreparedContext()
createPreparedContext
in interface EhcacheXAStore
public Store getUnderlyingStore()
getUnderlyingStore
in interface EhcacheXAStore
|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |