Class XATransactionContext


  • public class XATransactionContext
    extends java.lang.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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()  
      • 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 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:
        toString in class java.lang.Object