ehcache

net.sf.ehcache.transaction.xa
Class XATransactionContext

java.lang.Object
  extended by net.sf.ehcache.transaction.xa.XATransactionContext

public class XATransactionContext
extends Object

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

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

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 deferred
element - Element the command impacts, may be null

getCommands

public List<Command> getCommands()
All ordered pending commands

Returns:
List of all pending commands

get

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 - the key
Returns:
the potential Element instance for that key

isRemoved

public boolean isRemoved(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 Collection getAddedKeys()
Queries the local tx context, whether the key is pending removal

Returns:
true if key is pending removal

getRemovedKeys

public 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 String toString()
Overrides:
toString in class Object

ehcache

Copyright 2001-2017, Terracotta, Inc.