Package org.infinispan.context.impl
Class AbstractTxInvocationContext<T extends AbstractCacheTransaction>
java.lang.Object
org.infinispan.context.impl.AbstractInvocationContext
org.infinispan.context.impl.AbstractTxInvocationContext<T>
- All Implemented Interfaces:
Cloneable,EntryLookup,TxInvocationContext<T>,InvocationContext
- Direct Known Subclasses:
LocalTxInvocationContext,RemoteTxInvocationContext
public abstract class AbstractTxInvocationContext<T extends AbstractCacheTransaction>
extends AbstractInvocationContext
implements TxInvocationContext<T>
Support class for
TxInvocationContext.- Since:
- 4.0
- Author:
- Mircea.Markus@jboss.com, Galder ZamarreƱo, Pedro Ruivo
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractTxInvocationContext(T cacheTransaction, Address origin) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddAffectedKey(Object key) final voidaddAllAffectedKeys(Collection<?> keys) Registers a new participant with the transaction.final voidaddLockedKey(Object key) Tracks the given key as locked by this invocation context.final voidReturns the set of keys that are affected by this transaction.final Tfinal GlobalTransactionReturns the id of the transaction associated with the current call.Returns the set of keys that are locked for writing.Returns the in behalf of which locks will be acquired.final Map<Object,CacheEntry> Retrieves a map of entries looked up within the current scope.final List<org.infinispan.commands.write.WriteCommand>Returns the modifications performed in the scope of the current transaction.final booleanChecks if there are modifications performed within the tx's scope.final booleanReturns true if this call is performed in the context of an transaction, false otherwise.final CacheEntrylookupEntry(Object key) Retrieves an entry from the collection of looked up entries in the current scope.final voidputLookedUpEntry(Object key, CacheEntry e) Puts an entry in the registry of looked up entries in the current scope.final voidvoidsetLockOwner(Object lockOwner) Sets the object to be used by lock owner.Methods inherited from class org.infinispan.context.impl.AbstractInvocationContext
clone, getOrigin, hasLockedKey, isEntryRemovedInContext, isOriginLocal, publisherMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.infinispan.context.EntryLookup
forEachEntry, forEachValue, lookedUpEntriesCount, publisher, removeLookedUpEntriesMethods inherited from interface org.infinispan.context.InvocationContext
addLockedKeys, clone, getOrigin, hasLockedKey, isEntryRemovedInContext, isOriginLocalMethods inherited from interface org.infinispan.context.impl.TxInvocationContext
getTransaction, isImplicitTransaction, isTransactionValid
-
Constructor Details
-
AbstractTxInvocationContext
-
-
Method Details
-
getLockOwner
Description copied from interface:InvocationContextReturns the in behalf of which locks will be acquired.- Specified by:
getLockOwnerin interfaceInvocationContext
-
setLockOwner
Description copied from interface:InvocationContextSets the object to be used by lock owner.- Specified by:
setLockOwnerin interfaceInvocationContext
-
getLockedKeys
Description copied from interface:InvocationContextReturns the set of keys that are locked for writing.- Specified by:
getLockedKeysin interfaceInvocationContext
-
addLockedKey
Description copied from interface:InvocationContextTracks the given key as locked by this invocation context.- Specified by:
addLockedKeyin interfaceInvocationContext
-
getGlobalTransaction
Description copied from interface:TxInvocationContextReturns the id of the transaction associated with the current call.- Specified by:
getGlobalTransactionin interfaceTxInvocationContext<T extends AbstractCacheTransaction>
-
hasModifications
public final boolean hasModifications()Description copied from interface:TxInvocationContextChecks if there are modifications performed within the tx's scope. Any modifications having Flag.CACHE_MODE_LOCAL are ignored.- Specified by:
hasModificationsin interfaceTxInvocationContext<T extends AbstractCacheTransaction>
-
getModifications
Description copied from interface:TxInvocationContextReturns the modifications performed in the scope of the current transaction. Any modifications having Flag.CACHE_MODE_LOCAL are ignored. The returned list can be null.- Specified by:
getModificationsin interfaceTxInvocationContext<T extends AbstractCacheTransaction>
-
lookupEntry
Description copied from interface:EntryLookupRetrieves an entry from the collection of looked up entries in the current scope.- Specified by:
lookupEntryin interfaceEntryLookup- Parameters:
key- key to look up- Returns:
- an entry, or null if it cannot be found.
-
getLookedUpEntries
Description copied from interface:EntryLookupRetrieves a map of entries looked up within the current scope. Note: The key inside the CacheEntry may benullif the key does not exist in the cache.- Specified by:
getLookedUpEntriesin interfaceEntryLookup- Returns:
- a map of looked up entries.
-
getAffectedKeys
Description copied from interface:TxInvocationContextReturns 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:
getAffectedKeysin interfaceTxInvocationContext<T extends AbstractCacheTransaction>
-
addAllAffectedKeys
Description copied from interface:TxInvocationContextRegisters a new participant with the transaction.- Specified by:
addAllAffectedKeysin interfaceTxInvocationContext<T extends AbstractCacheTransaction>
-
addAffectedKey
- Specified by:
addAffectedKeyin interfaceTxInvocationContext<T extends AbstractCacheTransaction>
-
putLookedUpEntry
Description copied from interface:EntryLookupPuts an entry in the registry of looked up entries in the current scope.- Specified by:
putLookedUpEntryin interfaceEntryLookup- Parameters:
key- key to storee- entry to store
-
removeLookedUpEntry
- Specified by:
removeLookedUpEntryin interfaceEntryLookup
-
isInTxScope
public final boolean isInTxScope()Description copied from interface:InvocationContextReturns true if this call is performed in the context of an transaction, false otherwise.- Specified by:
isInTxScopein interfaceInvocationContext
-
clearLockedKeys
public final void clearLockedKeys()- Specified by:
clearLockedKeysin interfaceInvocationContext
-
getCacheTransaction
- Specified by:
getCacheTransactionin interfaceTxInvocationContext<T extends AbstractCacheTransaction>
-