ehcache

net.sf.ehcache.transaction
Interface TransactionContext

All Known Implementing Classes:
XATransactionContext

public interface TransactionContext

A TransactionContext represents the data local to a Transaction that involves a transactional Cache.

It will queue operations (Commands), filter read operations on the cache (as for returning null on a get on a "to be removed" key).

It also provides access to the transaction orchestrator (like the TransactionManager in case of JTA) to the deferred operations and other contextual information.

Author:
Alex Snaps

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
 

Method Detail

addCommand

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

Parameters:
command - Command to be deferred
element - Element the command impacts, may be null

get

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

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

Parameters:
key - the key
Returns:
the potential Element instance for that key

isRemoved

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

Parameters:
key - the key pending removal
Returns:
true if key is pending removal

getAddedKeys

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

Returns:
list of all keys

getRemovedKeys

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

Returns:
list of all keys

getSizeModifier

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)

Returns:
the modifier to be applied on the Store.getSize()

getCommands

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

Returns:
List of all pending commands

getUpdatedKeys

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

Returns:
UnmodifiableSet of keys pending changes

ehcache

true