org.infinispan.context.impl
Class AbstractTxInvocationContext

java.lang.Object
  extended by org.infinispan.context.impl.AbstractInvocationContext
      extended by org.infinispan.context.impl.AbstractTxInvocationContext
All Implemented Interfaces:
Cloneable, EntryLookup, FlagContainer, TxInvocationContext, InvocationContext
Direct Known Subclasses:
LocalTxInvocationContext, RemoteTxInvocationContext

public abstract class AbstractTxInvocationContext
extends AbstractInvocationContext
implements TxInvocationContext

Support class for TxInvocationContext.

Since:
4.0
Author:
Mircea.Markus@jboss.com, Galder ZamarreƱo

Nested Class Summary
 
Nested classes/interfaces inherited from class org.infinispan.context.impl.AbstractInvocationContext
AbstractInvocationContext.ContextFlag
 
Field Summary
 
Fields inherited from class org.infinispan.context.impl.AbstractInvocationContext
contextFlags, flags
 
Constructor Summary
AbstractTxInvocationContext()
           
 
Method Summary
 void addAffectedKey(Object key)
           
 void addAllAffectedKeys(Collection<Object> keys)
          Registers a new participant with the transaction.
 void clearLockedKeys()
           
 Set<Object> getAffectedKeys()
          Returns the set of keys that are affected by this transaction.
abstract  AbstractCacheTransaction getCacheTransaction()
           
 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 isInTxScope()
          Returns true if this call is performed in the context of an transaction, false otherwise.
 void reset()
           
 void setImplicitTransaction(boolean implicit)
          Marks this transaction as implicit; implicit transactions are started for transactional caches that have the autoCommit enabled.
 TxInvocationContext setTransaction(Transaction transaction)
           
 
Methods inherited from class org.infinispan.context.impl.AbstractInvocationContext
clone, getClassLoader, getFlags, getOrigin, hasFlag, hasLockedKey, isContextFlagSet, isFlagsUninitialized, isUseFutureReturnType, setClassLoader, setContextFlag, setContextFlag, setFlags, setFlags, setOrigin, setUseFutureReturnType, toString, unsetContextFlag
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.infinispan.context.impl.TxInvocationContext
getGlobalTransaction, getModifications, isTransactionValid
 
Methods inherited from interface org.infinispan.context.InvocationContext
addLockedKey, clone, getClassLoader, getLockedKeys, getLockOwner, getOrigin, hasLockedKey, 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, setFlags, setFlags
 

Constructor Detail

AbstractTxInvocationContext

public AbstractTxInvocationContext()
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

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

addAffectedKey

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

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

reset

public void reset()
Specified by:
reset in interface FlagContainer
Overrides:
reset in class AbstractInvocationContext

isInTxScope

public boolean isInTxScope()
Description copied from interface: InvocationContext
Returns true if this call is performed in the context of an transaction, false otherwise.

Specified by:
isInTxScope in interface InvocationContext

setTransaction

public TxInvocationContext setTransaction(Transaction transaction)

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

clearLockedKeys

public final void clearLockedKeys()
Specified by:
clearLockedKeys in interface InvocationContext

getCacheTransaction

public abstract AbstractCacheTransaction getCacheTransaction()
Specified by:
getCacheTransaction in interface TxInvocationContext

-->

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