Package org.infinispan.context.impl
Class LocalTxInvocationContext
- java.lang.Object
-
- org.infinispan.context.impl.AbstractInvocationContext
-
- org.infinispan.context.impl.AbstractTxInvocationContext<LocalTransaction>
-
- org.infinispan.context.impl.LocalTxInvocationContext
-
- All Implemented Interfaces:
Cloneable,EntryLookup,TxInvocationContext<LocalTransaction>,InvocationContext
public class LocalTxInvocationContext extends AbstractTxInvocationContext<LocalTransaction>
Invocation context to be used for locally originated transactions.- Since:
- 4.0
- Author:
- Mircea.Markus@jboss.com, Galder ZamarreƱo, Pedro Ruivo
-
-
Constructor Summary
Constructors Constructor Description LocalTxInvocationContext(LocalTransaction localTransaction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<Address>getRemoteLocksAcquired()TransactiongetTransaction()Returns the tx associated with the current thread.booleanhasLockedKey(Object key)Returns true if the lock being tested is already held in the current scope, false otherwise.booleanisImplicitTransaction()booleanisOriginLocal()Returns true if the call was originated locally, false if it is the result of a remote rpc.booleanisTransactionValid()voidremoteLocksAcquired(Collection<Address> nodes)-
Methods inherited from class org.infinispan.context.impl.AbstractTxInvocationContext
addAffectedKey, addAllAffectedKeys, addLockedKey, clearLockedKeys, getAffectedKeys, getCacheTransaction, getGlobalTransaction, getLockedKeys, getLockOwner, getLookedUpEntries, getModifications, hasModifications, isInTxScope, lookupEntry, putLookedUpEntry, removeLookedUpEntry, setLockOwner
-
Methods inherited from class org.infinispan.context.impl.AbstractInvocationContext
clone, getClassLoader, getOrigin, isEntryRemovedInContext, onEntryValueReplaced, setClassLoader
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.context.EntryLookup
forEachEntry, forEachValue, lookedUpEntriesCount, removeLookedUpEntries
-
Methods inherited from interface org.infinispan.context.InvocationContext
clone, getClassLoader, getOrigin, isEntryRemovedInContext, replaceValue, setClassLoader
-
-
-
-
Constructor Detail
-
LocalTxInvocationContext
public LocalTxInvocationContext(LocalTransaction localTransaction)
-
-
Method Detail
-
isTransactionValid
public final boolean isTransactionValid()
- Returns:
- true if the current transaction is in a valid state to perform operations on (i.e.,RUNNING or PREPARING) or false otherwise.
-
isImplicitTransaction
public final boolean isImplicitTransaction()
-
isOriginLocal
public final boolean isOriginLocal()
Description copied from interface:InvocationContextReturns true if the call was originated locally, false if it is the result of a remote rpc.- Specified by:
isOriginLocalin interfaceInvocationContext- Overrides:
isOriginLocalin classAbstractInvocationContext
-
hasLockedKey
public final boolean hasLockedKey(Object key)
Description copied from interface:InvocationContextReturns true if the lock being tested is already held in the current scope, false otherwise.- Specified by:
hasLockedKeyin interfaceInvocationContext- Overrides:
hasLockedKeyin classAbstractInvocationContext- Parameters:
key- lock to test
-
remoteLocksAcquired
public final void remoteLocksAcquired(Collection<Address> nodes)
-
getRemoteLocksAcquired
public final Collection<Address> getRemoteLocksAcquired()
-
getTransaction
public final Transaction getTransaction()
Description copied from interface:TxInvocationContextReturns the tx associated with the current thread. This method MUST be guarded with a call toInvocationContext.isOriginLocal(), asTransactionare not propagated from the node where tx was started.
-
-