ehcache

net.sf.ehcache.transaction.xa
Class XATransactionContext

java.lang.Object
  extended by net.sf.ehcache.transaction.xa.XATransactionContext
All Implemented Interfaces:
TransactionContext

public class XATransactionContext
extends java.lang.Object
implements TransactionContext

XATransactionContext provides a READ_COMMITED transaction isolation to an EhcacheXAResource.

It uses an EhcacheXAStore to persist data as needed

Author:
Alex Snaps

Constructor Summary
XATransactionContext(javax.transaction.xa.Xid xid, EhcacheXAStore store)
           
 
Method Summary
 void addCommand(Command command, Element element)
          Add a command to the current TransactionContext
 Element get(java.lang.Object key)
          Filter to get operations on underlying Store.
 java.util.Collection getAddedKeys()
          getter to all keys pending addition to the store
 java.util.List<VersionAwareCommand> getCommands()
          All ordered pending commands
 java.util.Collection getRemovedKeys()
          getter to all keys pending deletion from the store
 int getSizeModifier()
          The underlying store's size modifier.
 java.util.Set<java.lang.Object> getUpdatedKeys()
          All keys to pending keys to update
 boolean isRemoved(java.lang.Object key)
          Queries the local tx context, whether the key is pending removal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XATransactionContext

public XATransactionContext(javax.transaction.xa.Xid xid,
                            EhcacheXAStore store)
Parameters:
xid - The Xid of the Transaction
store - The store associated with the this XATransactionContext
Method Detail

get

public Element get(java.lang.Object key)
Filter to get operations on underlying Store.

Should the key still be transaction local, or locally pending deletion

Specified by:
get in interface TransactionContext
Parameters:
key - the key
Returns:
the potential Element instance for that key

isRemoved

public boolean isRemoved(java.lang.Object key)
Queries the local tx context, whether the key is pending removal

Specified by:
isRemoved in interface TransactionContext
Parameters:
key - the key pending removal
Returns:
true if key is pending removal

getAddedKeys

public java.util.Collection getAddedKeys()
getter to all keys pending addition to the store

Specified by:
getAddedKeys in interface TransactionContext
Returns:
list of all keys

getRemovedKeys

public java.util.Collection getRemovedKeys()
getter to all keys pending deletion from the store

Specified by:
getRemovedKeys in interface TransactionContext
Returns:
list of all keys

addCommand

public void addCommand(Command command,
                       Element element)
Add a command to the current TransactionContext

Specified by:
addCommand in interface TransactionContext
Parameters:
command - Command to be deferred
element - Element the command impacts, may be null

getCommands

public java.util.List<VersionAwareCommand> getCommands()
All ordered pending commands

Specified by:
getCommands in interface TransactionContext
Returns:
List of all pending commands

getUpdatedKeys

public java.util.Set<java.lang.Object> getUpdatedKeys()
All keys to pending keys to update

Specified by:
getUpdatedKeys in interface TransactionContext
Returns:
UnmodifiableSet of keys pending changes

getSizeModifier

public int getSizeModifier()
The underlying store's size modifier.

Plus all pending put commands, and minus all pending removals (dependent on whether their in the underlying store)

Specified by:
getSizeModifier in interface TransactionContext
Returns:
the modifier to be applied on the Store.getSize()

ehcache

true