Interface CacheTransaction

    • Method Detail

      • getGlobalTransaction

        GlobalTransaction getGlobalTransaction()
        Returns the transaction identifier.
      • getModifications

        java.util.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

        java.util.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

        boolean hasModification​(java.lang.Class<?> modificationClass)
        Checks if a modification of the given class (or subclass) is present in this transaction. Any modifications using Flag#CACHE_MODE_LOCAL are ignored.
        modificationClass - the modification type to look for
        true if found, false otherwise
      • lookupEntry

        CacheEntry lookupEntry​(java.lang.Object key)
      • getLookedUpEntries

        java.util.Map<java.lang.Object,​CacheEntry> getLookedUpEntries()
      • putLookedUpEntry

        void putLookedUpEntry​(java.lang.Object key,
                              CacheEntry e)
      • putLookedUpEntries

        void putLookedUpEntries​(java.util.Map<java.lang.Object,​CacheEntry> entries)
      • removeLookedUpEntry

        void removeLookedUpEntry​(java.lang.Object key)
      • clearLookedUpEntries

        void clearLookedUpEntries()
      • ownsLock

        boolean ownsLock​(java.lang.Object key)
      • clearLockedKeys

        void clearLockedKeys()
      • getLockedKeys

        java.util.Set<java.lang.Object> getLockedKeys()
      • getTopologyId

        int getTopologyId()
      • getBackupLockedKeys

        java.util.Set<java.lang.Object> getBackupLockedKeys()
        Since 9.3, please use forEachBackupLock(Consumer)
        testing purpose only!
      • addBackupLockForKey

        void addBackupLockForKey​(java.lang.Object key)
      • waitForLockRelease

        boolean waitForLockRelease​(long lockAcquisitionTimeout)
                            throws java.lang.InterruptedException
        Checks if this transaction holds a lock on the given key and then waits until the transaction completes or until the timeout expires and returns true if the transaction is complete or false otherwise. If the key is not locked or if the transaction is already completed it returns true immediately.

        This method is subject to spurious returns in a way similar to Object.wait(). It can sometimes return before the specified time has elapsed and without guaranteeing that this transaction is complete. The caller is responsible to call the method again if transaction completion was not reached and the time budget was not spent.

        See Also:
        AbstractTxLockingInterceptor.checkPendingAndLockKey(InvocationContext, Object, long)
      • containsLockOrBackupLock

        boolean containsLockOrBackupLock​(java.lang.Object key)
      • findAnyLockedOrBackupLocked

        java.lang.Object findAnyLockedOrBackupLocked​(java.util.Collection<java.lang.Object> keys)
      • areLocksReleased

        boolean areLocksReleased()
      • setUpdatedEntryVersions

        void setUpdatedEntryVersions​(EntryVersionsMap updatedEntryVersions)
      • putLookedUpRemoteVersion

        default void putLookedUpRemoteVersion​(java.lang.Object key,
                                              EntryVersion version)
        since 9.0
      • getLookedUpRemoteVersion

        default EntryVersion getLookedUpRemoteVersion​(java.lang.Object key)
        since 9.0
      • keyRead

        default boolean keyRead​(java.lang.Object key)
        since 9.1 Use MVCCEntry.isRead() instead
      • addReadKey

        default void addReadKey​(java.lang.Object key)
        since 9.1 Use MVCCEntry.setRead() instead
      • isMarkedForRollback

        boolean isMarkedForRollback()
      • markForRollback

        void markForRollback​(boolean markForRollback)
      • addVersionRead

        void addVersionRead​(java.lang.Object key,
                            EntryVersion version)
        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.

      • replaceVersionRead

        default void replaceVersionRead​(java.lang.Object key,
                                        EntryVersion version)
        since 9.0
        Sets the version read fr this key, replacing the old version if it exists, i.e each invocation updates the version of the key. This method is used when a remote get is performed for the key.

        Note: used in Repeatable Read + Write Skew + Clustering + Versioning.

      • getVersionsRead

        EntryVersionsMap getVersionsRead()
        Note: used in Repeatable Read + Write Skew + Clustering + Versioning.
        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()
      • freezeModifications

        void freezeModifications()
        Prevent new modifications after prepare or commit started.
      • getReleaseFutureForKey

        java.util.concurrent.CompletableFuture<java.lang.Void> getReleaseFutureForKey​(java.lang.Object key)
        It returns a CompletableFuture that completes when the lock for the key is released. If the key is not locked by this transaction, it returns null.
        key - the key.
        the CompletableFuture or null if the key is not locked by this transaction.
      • getReleaseFutureForKeys

        java.util.Map<java.lang.Object,​java.util.concurrent.CompletableFuture<java.lang.Void>> getReleaseFutureForKeys​(java.util.Collection<java.lang.Object> keys)
        Same as getReleaseFutureForKey(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

        void removeBackupLocks​(java.util.Collection<?> keys)
        It cleans up the backup lock for the keys.
        keys - The keys to clean up the backup lock.
      • removeBackupLock

        void removeBackupLock​(java.lang.Object key)
        It cleans up the backup for key.
        key - The key to clean up the backup lock.
      • forEachBackupLock

        void forEachBackupLock​(java.util.function.Consumer<java.lang.Object> consumer)
        Invokes the Consumer with each backup lock.
        consumer - The backup lock Consumer