Package org.infinispan.transaction.xa
Interface CacheTransaction
- All Known Subinterfaces:
RecoveryAwareTransaction
- All Known Implementing Classes:
AbstractCacheTransaction
,LocalTransaction
,LocalXaTransaction
,RecoveryAwareLocalTransaction
,RecoveryAwareRemoteTransaction
,RemoteTransaction
,SyncLocalTransaction
public interface CacheTransaction
Defines the state a infinispan transaction should have.
- Since:
- 4.0
- Author:
- Mircea.Markus@jboss.com
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
addVersionRead
(Object key, EntryVersion version) Sets the version read for this key.void
It cleans up the backup locks for this transaction.void
void
void
forEachBackupLock
(Consumer<Object> consumer) Invokes theConsumer
with each backup lock.void
forEachLock
(Consumer<Object> consumer) Invokes theConsumer
with each lock.void
Prevent new modifications after prepare or commit started.List
<org.infinispan.commands.write.WriteCommand> Returns all the modifications visible within the current transaction, including those using Flag#CACHE_MODE_LOCAL.long
Returns the transaction identifier.List
<org.infinispan.commands.write.WriteCommand> Returns the modifications visible within the current transaction.It returns aCompletableFuture
that completes when the lock for thekey
is released.Same asgetReleaseFutureForKey(Object)
but it returns a pair with the key and the future.int
Note: used in Repeatable Read + Write Skew + Clustering + Versioning.default boolean
hasModification
(Class<?> modificationClass) Deprecated, for removal: This API element is subject to removal in a future version.since 14.0.boolean
lookupEntry
(Object key) void
markForRollback
(boolean markForRollback) void
boolean
void
putLookedUpEntries
(Map<Object, CacheEntry> entries) void
putLookedUpEntry
(Object key, CacheEntry e) void
removeBackupLock
(Object key) It cleans up the backup forkey
.void
removeBackupLocks
(Collection<?> keys) It cleans up the backup lock for thekeys
.void
void
setUpdatedEntryVersions
(Map<Object, IncrementableEntryVersion> updatedEntryVersions)
-
Method Details
-
getGlobalTransaction
GlobalTransaction getGlobalTransaction()Returns the transaction identifier. -
getModifications
List<org.infinispan.commands.write.WriteCommand> getModifications()Returns the modifications visible within the current transaction. Any modifications using Flag#CACHE_MODE_LOCAL are excluded. The returned list is never null. -
getAllModifications
List<org.infinispan.commands.write.WriteCommand> getAllModifications()Returns all the modifications visible within the current transaction, including those using Flag#CACHE_MODE_LOCAL. The returned list is never null. -
hasModification
@Deprecated(forRemoval=true, since="14.0") default boolean hasModification(Class<?> modificationClass) Deprecated, for removal: This API element is subject to removal in a future version.since 14.0. To be removed without replacement.Checks if a modification of the given class (or subclass) is present in this transaction. Any modifications using Flag#CACHE_MODE_LOCAL are ignored.- Parameters:
modificationClass
- the modification type to look for- Returns:
- true if found, false otherwise
-
lookupEntry
-
getLookedUpEntries
Map<Object,CacheEntry> getLookedUpEntries() -
putLookedUpEntry
-
putLookedUpEntries
-
removeLookedUpEntry
-
clearLookedUpEntries
void clearLookedUpEntries() -
ownsLock
-
clearLockedKeys
void clearLockedKeys() -
getLockedKeys
-
getTopologyId
int getTopologyId() -
addBackupLockForKey
-
notifyOnTransactionFinished
void notifyOnTransactionFinished()- See Also:
-
getUpdatedEntryVersions
Map<Object,IncrementableEntryVersion> getUpdatedEntryVersions() -
setUpdatedEntryVersions
-
isMarkedForRollback
boolean isMarkedForRollback() -
markForRollback
void markForRollback(boolean markForRollback) -
addVersionRead
Sets the version read for this key. The version is only set at the first time, i.e. multiple invocation of this method will not change the state. Note: used in Repeatable Read + Write Skew + Clustering + Versioning. -
getVersionsRead
Map<Object,IncrementableEntryVersion> getVersionsRead()Note: used in Repeatable Read + Write Skew + Clustering + Versioning.- Returns:
- a non-null map between key and version. The map represents the version read for that key. If no version exists, the key has not been read.
-
getCreationTime
long getCreationTime() -
addListener
-
freezeModifications
void freezeModifications()Prevent new modifications after prepare or commit started. -
getReleaseFutureForKey
It returns aCompletableFuture
that completes when the lock for thekey
is released. If thekey
is not locked by this transaction, it returnsnull
.- Parameters:
key
- the key.- Returns:
- the
CompletableFuture
ornull
if the key is not locked by this transaction.
-
getReleaseFutureForKeys
Same asgetReleaseFutureForKey(Object)
but it returns a pair with the key and the future. -
cleanupBackupLocks
void cleanupBackupLocks()It cleans up the backup locks for this transaction. -
removeBackupLocks
It cleans up the backup lock for thekeys
.- Parameters:
keys
- The keys to clean up the backup lock.
-
removeBackupLock
It cleans up the backup forkey
.- Parameters:
key
- The key to clean up the backup lock.
-
forEachLock
Invokes theConsumer
with each lock.- Parameters:
consumer
- The backup lockConsumer
-
forEachBackupLock
Invokes theConsumer
with each backup lock.- Parameters:
consumer
- The backup lockConsumer
-