Package net.sf.ehcache.transaction.xa
Class XATransactionContext
- java.lang.Object
-
- net.sf.ehcache.transaction.xa.XATransactionContext
-
public class XATransactionContext extends java.lang.ObjectAn XATransactionContext 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).- Author:
- Ludovic Orban
-
-
Constructor Summary
Constructors Constructor Description XATransactionContext(Store underlyingStore)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCommand(Command command, Element element)Add a command to the current LocalTransactionContextElementget(java.lang.Object key)Filter to get operations on underlying Store.java.util.CollectiongetAddedKeys()Queries the local tx context, whether the key is pending removaljava.util.List<Command>getCommands()All ordered pending commandsjava.util.CollectiongetRemovedKeys()getter to all keys pending deletion from the storeintgetSizeModifier()The underlying store's size modifier.booleanisRemoved(java.lang.Object key)Queries the local tx context, whether the key is pending removaljava.lang.StringtoString()
-
-
-
Constructor Detail
-
XATransactionContext
public XATransactionContext(Store underlyingStore)
Constructor- Parameters:
underlyingStore- the underlying store
-
-
Method Detail
-
addCommand
public void addCommand(Command command, Element element)
Add a command to the current LocalTransactionContext- Parameters:
command- Command to be deferredelement- Element the command impacts, may be null
-
getCommands
public java.util.List<Command> getCommands()
All ordered pending commands- Returns:
- List of all pending commands
-
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
- 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- Parameters:
key- the key pending removal- Returns:
- true if key is pending removal
-
getAddedKeys
public java.util.Collection getAddedKeys()
Queries the local tx context, whether the key is pending removal- Returns:
- true if key is pending removal
-
getRemovedKeys
public java.util.Collection getRemovedKeys()
getter to all keys pending deletion from the store- Returns:
- list of all keys
-
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)
- Returns:
- the modifier to be applied on the
Store.getSize()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-