Package org.infinispan.context.impl
Interface TxInvocationContext<T extends AbstractCacheTransaction>
- All Superinterfaces:
Cloneable
,EntryLookup
,InvocationContext
- All Known Implementing Classes:
AbstractTxInvocationContext
,LocalTxInvocationContext
,RemoteTxInvocationContext
Interface defining additional functionality for invocation contexts that propagate within a transaction's scope.
- Since:
- 4.0
- Author:
- Mircea.Markus@jboss.com
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAffectedKey
(Object key) void
addAllAffectedKeys
(Collection<?> keys) Registers a new participant with the transaction.Returns the set of keys that are affected by this transaction.Returns the id of the transaction associated with the current call.List
<org.infinispan.commands.write.WriteCommand> Returns the modifications performed in the scope of the current transaction.jakarta.transaction.Transaction
Returns the tx associated with the current thread.boolean
Checks if there are modifications performed within the tx's scope.boolean
boolean
Methods inherited from interface org.infinispan.context.EntryLookup
forEachEntry, forEachValue, getLookedUpEntries, lookedUpEntriesCount, lookupEntry, publisher, putLookedUpEntry, removeLookedUpEntries, removeLookedUpEntry
Methods inherited from interface org.infinispan.context.InvocationContext
addLockedKey, addLockedKeys, clearLockedKeys, clone, getLockedKeys, getLockOwner, getOrigin, hasLockedKey, isEntryRemovedInContext, isInTxScope, isOriginLocal, setLockOwner
-
Method Details
-
hasModifications
boolean hasModifications()Checks if there are modifications performed within the tx's scope. Any modifications having Flag.CACHE_MODE_LOCAL are ignored. -
getAffectedKeys
Returns the set of keys that are affected by this transaction. Used to generate appropriate recipient groups for cluster-wide prepare and commit calls. -
getGlobalTransaction
GlobalTransaction getGlobalTransaction()Returns the id of the transaction associated with the current call. -
getModifications
List<org.infinispan.commands.write.WriteCommand> getModifications()Returns 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. -
getTransaction
jakarta.transaction.Transaction getTransaction()Returns the tx associated with the current thread. This method MUST be guarded with a call toInvocationContext.isOriginLocal()
, asinvalid reference
javax.transaction.Transaction
- Throws:
IllegalStateException
- if the call is performed from aInvocationContext.isOriginLocal()
==false context.
-
addAllAffectedKeys
Registers a new participant with the transaction. -
addAffectedKey
-
isTransactionValid
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
boolean isImplicitTransaction() -
getCacheTransaction
T getCacheTransaction()
-