public class XATransactionContext
extends java.lang.Object
It will queue operations (Commands
), filter read operations on the cache (as for
returning null on a get on a "to be removed" key).
Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.lang.Object> |
addedKeys |
private java.util.concurrent.ConcurrentMap<java.lang.Object,Element> |
commandElements |
private java.util.Map<java.lang.Object,Command> |
commands |
private static org.slf4j.Logger |
LOG |
private java.util.Set<java.lang.Object> |
removedKeys |
private int |
sizeModifier |
private Store |
underlyingStore |
Constructor and Description |
---|
XATransactionContext(Store underlyingStore)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addCommand(Command command,
Element element)
Add a command to the current LocalTransactionContext
|
Element |
get(java.lang.Object key)
Filter to get operations on underlying Store.
|
java.util.Collection |
getAddedKeys()
Queries the local tx context, whether the key is pending removal
|
java.util.List<Command> |
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.
|
boolean |
isRemoved(java.lang.Object key)
Queries the local tx context, whether the key is pending removal
|
java.lang.String |
toString() |
private static final org.slf4j.Logger LOG
private final java.util.concurrent.ConcurrentMap<java.lang.Object,Element> commandElements
private final java.util.Set<java.lang.Object> removedKeys
private final java.util.Set<java.lang.Object> addedKeys
private int sizeModifier
private final java.util.Map<java.lang.Object,Command> commands
private final Store underlyingStore
public XATransactionContext(Store underlyingStore)
underlyingStore
- the underlying storepublic void addCommand(Command command, Element element)
command
- Command to be deferredelement
- Element the command impacts, may be nullpublic java.util.List<Command> getCommands()
public Element get(java.lang.Object key)
Should the key still be transaction local, or locally pending deletion
key
- the keypublic boolean isRemoved(java.lang.Object key)
key
- the key pending removalpublic java.util.Collection getAddedKeys()
public java.util.Collection getRemovedKeys()
public int getSizeModifier()
Plus all pending put commands, and minus all pending removals (dependent on whether their in the underlying store)
Store.getSize()
public java.lang.String toString()
toString
in class java.lang.Object