Class DefaultPendingLockManager
- java.lang.Object
-
- org.infinispan.util.concurrent.locks.impl.DefaultPendingLockManager
-
- All Implemented Interfaces:
PendingLockManager
public class DefaultPendingLockManager extends Object implements PendingLockManager
The default implementation forPendingLockManager.In transactional caches, a transaction would wait for transaction originated in a older topology id. It can happen when topology changes and a backup owner becomes the primary owner.
- Since:
- 8.0
- Author:
- Pedro Ruivo
-
-
Constructor Summary
Constructors Constructor Description DefaultPendingLockManager()
-
Method Summary
-
-
-
Method Detail
-
checkPendingTransactionsForKey
public PendingLockPromise checkPendingTransactionsForKey(TxInvocationContext<?> ctx, Object key, long time, TimeUnit unit)
Description copied from interface:PendingLockManagerSame asPendingLockManager.awaitPendingTransactionsForKey(TxInvocationContext, Object, long, TimeUnit)but non-blocking.Multiple invocations with the same transaction returns the same
PendingLockPromise. For cleanup purposes,PendingLockManager.awaitPendingTransactionsForKey(TxInvocationContext, Object, long, TimeUnit)must be invoked afterwards.- Specified by:
checkPendingTransactionsForKeyin interfacePendingLockManager- Parameters:
ctx- theTxInvocationContext.key- the key to check.time- timeout.unit-TimeUnitoftime.- Returns:
- a
PendingLockPromise.
-
checkPendingTransactionsForKeys
public PendingLockPromise checkPendingTransactionsForKeys(TxInvocationContext<?> ctx, Collection<Object> keys, long time, TimeUnit unit)
Description copied from interface:PendingLockManagerSame asPendingLockManager.awaitPendingTransactionsForAllKeys(TxInvocationContext, Collection, long, TimeUnit)but non-blocking.Multiple invocations with the same transaction returns the same
PendingLockPromise. For cleanup purposes,PendingLockManager.awaitPendingTransactionsForAllKeys(TxInvocationContext, Collection, long, TimeUnit)must be invoked afterwards.- Specified by:
checkPendingTransactionsForKeysin interfacePendingLockManager- Parameters:
ctx- theTxInvocationContext.keys- the keys to check.time- timeout.unit-TimeUnitoftime.- Returns:
- a
PendingLockPromise.
-
awaitPendingTransactionsForKey
public long awaitPendingTransactionsForKey(TxInvocationContext<?> ctx, Object key, long time, TimeUnit unit) throws InterruptedException
Description copied from interface:PendingLockManagerIt waits for any transaction with older topology id to complete that may have the lock forkeyacquired.- Specified by:
awaitPendingTransactionsForKeyin interfacePendingLockManager- Parameters:
ctx- theTxInvocationContext.key- the key to check.time- timeout.unit-TimeUnitoftime.- Returns:
- the remaining timeout.
- Throws:
InterruptedException- if the thread is interrupted while waiting.
-
awaitPendingTransactionsForAllKeys
public long awaitPendingTransactionsForAllKeys(TxInvocationContext<?> ctx, Collection<Object> keys, long time, TimeUnit unit) throws InterruptedException
Description copied from interface:PendingLockManagerIt waits for any transaction with older topology id to complete that may have the lock for any key inkeysacquired.- Specified by:
awaitPendingTransactionsForAllKeysin interfacePendingLockManager- Parameters:
ctx- theTxInvocationContext.keys- the keys to check.time- timeout.unit-TimeUnitoftime.- Returns:
- the remaining timeout.
- Throws:
InterruptedException- if the thread is interrupted while waiting.
-
-