org.infinispan.context
Class TransactionalInvocationContextFlagsOverride

java.lang.Object
  extended by org.infinispan.context.InvocationContextFlagsOverride
      extended by org.infinispan.context.TransactionalInvocationContextFlagsOverride
All Implemented Interfaces:
Cloneable, EntryLookup, FlagContainer, TxInvocationContext, InvocationContext

public class TransactionalInvocationContextFlagsOverride
extends InvocationContextFlagsOverride
implements TxInvocationContext

Extension of InvocationContextFlagsOverride to be used when a TxInvocationContext is required.

Since:
5.0
Author:
Sanne Grinovero (C) 2011 Red Hat Inc.
See Also:
InvocationContextFlagsOverride

Constructor Summary
TransactionalInvocationContextFlagsOverride(TxInvocationContext delegate, Set<Flag> flags)
           
 
Method Summary
 void addAffectedKey(Object key)
           
 void addAllAffectedKeys(Collection<Object> keys)
          Registers a new participant with the transaction.
 Set<Object> getAffectedKeys()
          Returns the set of keys that are affected by this transaction.
 CacheTransaction getCacheTransaction()
           
 GlobalTransaction getGlobalTransaction()
          Returns the id of the transaction associated with the current call.
 List<WriteCommand> getModifications()
          Returns all the modifications performed in the scope of the current transaction.
 Transaction getTransaction()
          Returns the tx associated with the current thread.
 boolean hasModifications()
          Were there any modifications performed within the tx's scope?
 boolean isImplicitTransaction()
           
 boolean isTransactionValid()
           
 void setImplicitTransaction(boolean implicit)
          Marks this transaction as implicit; implicit transactions are started for transactional caches that have the autoCommit enabled.
 
Methods inherited from class org.infinispan.context.InvocationContextFlagsOverride
addLockedKey, clearLockedKeys, clearLookedUpEntries, clone, getClassLoader, getFlags, getLockedKeys, getLockOwner, getLookedUpEntries, getOrigin, hasFlag, hasLockedKey, isInTxScope, isOriginLocal, isUseFutureReturnType, lookupEntry, putLookedUpEntries, putLookedUpEntry, removeLookedUpEntry, reset, setClassLoader, setFlags, setFlags, setUseFutureReturnType
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.infinispan.context.InvocationContext
addLockedKey, clearLockedKeys, clone, getClassLoader, getLockedKeys, getLockOwner, getOrigin, hasLockedKey, isInTxScope, isOriginLocal, isUseFutureReturnType, setClassLoader, setUseFutureReturnType
 
Methods inherited from interface org.infinispan.context.EntryLookup
clearLookedUpEntries, getLookedUpEntries, lookupEntry, putLookedUpEntries, putLookedUpEntry, removeLookedUpEntry
 
Methods inherited from interface org.infinispan.context.FlagContainer
getFlags, hasFlag, reset, setFlags, setFlags
 

Constructor Detail

TransactionalInvocationContextFlagsOverride

public TransactionalInvocationContextFlagsOverride(TxInvocationContext delegate,
                                                   Set<Flag> flags)
Method Detail

hasModifications

public boolean hasModifications()
Description copied from interface: TxInvocationContext
Were there any modifications performed within the tx's scope?

Specified by:
hasModifications in interface TxInvocationContext

getAffectedKeys

public Set<Object> getAffectedKeys()
Description copied from interface: TxInvocationContext
Returns the set of keys that are affected by this transaction. Used to generate appropriate recipient groups for cluster-wide prepare and commit calls.

Specified by:
getAffectedKeys in interface TxInvocationContext

getGlobalTransaction

public GlobalTransaction getGlobalTransaction()
Description copied from interface: TxInvocationContext
Returns the id of the transaction associated with the current call.

Specified by:
getGlobalTransaction in interface TxInvocationContext

getModifications

public List<WriteCommand> getModifications()
Description copied from interface: TxInvocationContext
Returns all the modifications performed in the scope of the current transaction.

Specified by:
getModifications in interface TxInvocationContext

addAllAffectedKeys

public void addAllAffectedKeys(Collection<Object> keys)
Description copied from interface: TxInvocationContext
Registers a new participant with the transaction.

Specified by:
addAllAffectedKeys in interface TxInvocationContext

getTransaction

public Transaction getTransaction()
Description copied from interface: TxInvocationContext
Returns the tx associated with the current thread. This method MUST be guarded with a call to InvocationContext.isOriginLocal(), as Transaction are not propagated from the node where tx was started.

Specified by:
getTransaction in interface TxInvocationContext

isTransactionValid

public boolean isTransactionValid()
Specified by:
isTransactionValid in interface TxInvocationContext
Returns:
true if the current transaction is in a valid state to perform operations on (i.e.,RUNNING or PREPARING) or false otherwise.

setImplicitTransaction

public void setImplicitTransaction(boolean implicit)
Description copied from interface: TxInvocationContext
Marks this transaction as implicit; implicit transactions are started for transactional caches that have the autoCommit enabled.

Specified by:
setImplicitTransaction in interface TxInvocationContext

isImplicitTransaction

public boolean isImplicitTransaction()
Specified by:
isImplicitTransaction in interface TxInvocationContext

getCacheTransaction

public CacheTransaction getCacheTransaction()
Specified by:
getCacheTransaction in interface TxInvocationContext

addAffectedKey

public void addAffectedKey(Object key)
Specified by:
addAffectedKey in interface TxInvocationContext

-->

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