org.infinispan.context
Interface TransactionContext

All Superinterfaces:
EntryLookup, FlagContainer
All Known Implementing Classes:
TransactionContextImpl

public interface TransactionContext
extends EntryLookup, FlagContainer

A context that contains information pertaining to a given transaction. These contexts typically have the lifespan of the entire transaction.

Since:
4.0
Author:
Manik Surtani (manik@jboss.org)
See Also:
InvocationContext

Method Summary
 void addDummyEntryCreatedByCacheLoader(Object key)
          Adds a key to the list of uninitialized entry keys created by the cache loader.
 void addLocalModification(WriteCommand command)
          Adds a modification to the local modification list.
 void addModification(WriteCommand command)
          Adds a modification to the modification list.
 void addRemovedEntry(Object key)
          Adds the key that has been removed in the scope of the current transaction.
 List<Object> getDummyEntriesCreatedByCacheLoader()
           
 GlobalTransaction getGobalTransaction()
           
 List<WriteCommand> getLocalModifications()
          Returns all modifications that have been invoked with the LOCAL cache mode option.
 List<WriteCommand> getModifications()
          Returns all modifications.
 List<Object> getRemovedEntries()
          Gets the list of removed keys.
 Transaction getTransaction()
          Returns a local transaction associated with this context.
 boolean hasAnyModifications()
           
 boolean hasLocalModifications()
           
 boolean hasModifications()
           
 boolean isForceAsyncReplication()
          Gets the value of the forceAsyncReplication flag.
 boolean isForceSyncReplication()
          Gets the value of the forceSyncReplication flag.
 void reset()
          Cleans up internal state, freeing up references.
 void setForceAsyncReplication(boolean forceAsyncReplication)
          Sets the value of the forceAsyncReplication flag.
 void setForceSyncReplication(boolean forceSyncReplication)
          Sets the value of the forceSyncReplication flag.
 void setGlobalTransaction(GlobalTransaction gtx)
           
 void setTransaction(Transaction tx)
          Sets the local transaction to be associated with this transaction context.
 
Methods inherited from interface org.infinispan.context.EntryLookup
clearLookedUpEntries, getLookedUpEntries, hasLockedKey, isContainsLocks, isContainsModifications, lookupEntry, putLookedUpEntries, putLookedUpEntry, removeLookedUpEntry, setContainsLocks, setContainsModifications
 
Methods inherited from interface org.infinispan.context.FlagContainer
getFlags, hasFlag, isFlagsUninitialized, resetFlags, setFlags, setFlags
 

Method Detail

addModification

void addModification(WriteCommand command)
Adds a modification to the modification list.

Parameters:
command - modification

getModifications

List<WriteCommand> getModifications()
Returns all modifications. If there are no modifications in this transaction this method will return an empty list.

Returns:
list of modifications.

addLocalModification

void addLocalModification(WriteCommand command)
Adds a modification to the local modification list.

Parameters:
command - command to add to list. Should not be null.
Throws:
NullPointerException - if the command to be added is null.

getLocalModifications

List<WriteCommand> getLocalModifications()
Returns all modifications that have been invoked with the LOCAL cache mode option. These will also be in the standard modification list.

Returns:
list of LOCAL modifications, or an empty list.

addRemovedEntry

void addRemovedEntry(Object key)
Adds the key that has been removed in the scope of the current transaction.

Parameters:
key - key that has been removed.
Throws:
NullPointerException - if the key is null.

getRemovedEntries

List<Object> getRemovedEntries()
Gets the list of removed keys.

Returns:
list of keys of entries removed in the current transaction scope. Note that this method will return an empty list if nothing has been removed. The list returned is defensively copied.

setTransaction

void setTransaction(Transaction tx)
Sets the local transaction to be associated with this transaction context.

Parameters:
tx - JTA transaction to associate with.

setGlobalTransaction

void setGlobalTransaction(GlobalTransaction gtx)

getTransaction

Transaction getTransaction()
Returns a local transaction associated with this context.

Returns:
a JTA transaction

isForceAsyncReplication

boolean isForceAsyncReplication()
Gets the value of the forceAsyncReplication flag.

Returns:
true if the forceAsyncReplication flag is set to true.

setForceAsyncReplication

void setForceAsyncReplication(boolean forceAsyncReplication)
Sets the value of the forceAsyncReplication flag.

Parameters:
forceAsyncReplication - value of forceAsyncReplication

isForceSyncReplication

boolean isForceSyncReplication()
Gets the value of the forceSyncReplication flag.

Returns:
true if the forceAsyncReplication flag is set to true.

setForceSyncReplication

void setForceSyncReplication(boolean forceSyncReplication)
Sets the value of the forceSyncReplication flag.

Parameters:
forceSyncReplication - value of forceSyncReplication

addDummyEntryCreatedByCacheLoader

void addDummyEntryCreatedByCacheLoader(Object key)
Adds a key to the list of uninitialized entry keys created by the cache loader.

Parameters:
key - key to add. Must not be null.

getDummyEntriesCreatedByCacheLoader

List<Object> getDummyEntriesCreatedByCacheLoader()
Returns:
a list of uninitialized entries created by the cache loader, or an empty list.

hasModifications

boolean hasModifications()
Returns:
true if modifications were registered.

hasLocalModifications

boolean hasLocalModifications()
Returns:
true if any modifications have been invoked with cache mode being LOCAL.

hasAnyModifications

boolean hasAnyModifications()
Returns:
true if either there are modifications or local modifications that are not for replicating.

reset

void reset()
Cleans up internal state, freeing up references.


getGobalTransaction

GlobalTransaction getGobalTransaction()


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.