Top Description Fields Constructors Methods
net.sf.ehcache.transaction.xa

public Class XATransactionContext

extends Object
Class Inheritance
Imports
net.sf.ehcache.Element, net.sf.ehcache.store.Store, net.sf.ehcache.transaction.xa.commands.Command, org.slf4j.Logger, .LoggerFactory, java.util.ArrayList, .Collection, .Collections, .HashSet, .LinkedHashMap, .List, .Map, .Set, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap

An 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

Field Summary

Modifier and TypeField and Description
private final Set<Object>
private final ConcurrentMap<Object, Element>
private final Map<Object, Command>
private static final Logger
private final Set<Object>
private int
private final Store

Constructor Summary

AccessConstructor and Description
public
XATransactionContext(Store
the underlying store
underlyingStore
)

Constructor

Method Summary

Modifier and TypeMethod and Description
public void
addCommand(final Command
Command to be deferred
command
,
final Element
Element the command impacts, may be null
element
)

Add a command to the current LocalTransactionContext

public Element

Returns:

the potential Element instance for that key
get
(Object
the key
key
)

Filter to get operations on underlying Store.

public Collection<E>

Returns:

true if key is pending removal
getAddedKeys
()

Queries the local tx context, whether the key is pending removal

public List<Command>

Returns:

List of all pending commands
getCommands
()

All ordered pending commands

public Collection<E>

Returns:

list of all keys
getRemovedKeys
()

getter to all keys pending deletion from the store

public int

Returns:

the modifier to be applied on the net.sf.ehcache.store.Store#getSize()
getSizeModifier
()

The underlying store's size modifier.

public boolean

Returns:

true if key is pending removal
isRemoved
(Object
the key pending removal
key
)

Queries the local tx context, whether the key is pending removal

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

addedKeysback to summary
private final Set<Object> addedKeys
commandElementsback to summary
private final ConcurrentMap<Object, Element> commandElements
commandsback to summary
private final Map<Object, Command> commands
LOGback to summary
private static final Logger LOG
removedKeysback to summary
private final Set<Object> removedKeys
sizeModifierback to summary
private int sizeModifier
underlyingStoreback to summary
private final Store underlyingStore

Constructor Detail

XATransactionContextback to summary
public XATransactionContext(Store underlyingStore)

Constructor

Parameters
underlyingStore:Store

the underlying store

Method Detail

addCommandback to summary
public void addCommand(final Command command, final Element element)

Add a command to the current LocalTransactionContext

Parameters
command:Command

Command to be deferred

element:Element

Element the command impacts, may be null

getback to summary
public Element get(Object key)

Filter to get operations on underlying Store.

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

Parameters
key:Object

the key

Returns:Element

the potential Element instance for that key

getAddedKeysback to summary
public Collection<E> getAddedKeys()

Queries the local tx context, whether the key is pending removal

Returns:Collection<E>

true if key is pending removal

getCommandsback to summary
public List<Command> getCommands()

All ordered pending commands

Returns:List<Command>

List of all pending commands

getRemovedKeysback to summary
public Collection<E> getRemovedKeys()

getter to all keys pending deletion from the store

Returns:Collection<E>

list of all keys

getSizeModifierback to summary
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:int

the modifier to be applied on the net.sf.ehcache.store.Store#getSize()

isRemovedback to summary
public boolean isRemoved(Object key)

Queries the local tx context, whether the key is pending removal

Parameters
key:Object

the key pending removal

Returns:boolean

true if key is pending removal

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override