Interface PendingLockManager
-
- All Known Implementing Classes:
DefaultPendingLockManager
,NoOpPendingLockManager
public interface PendingLockManager
A manager that checks and waits for older topology transaction with conflicting keys.- Since:
- 8.0
- Author:
- Pedro Ruivo
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
awaitPendingTransactionsForAllKeys(TxInvocationContext<?> ctx, Collection<Object> keys, long time, TimeUnit unit)
It waits for any transaction with older topology id to complete that may have the lock for any key inkeys
acquired.long
awaitPendingTransactionsForKey(TxInvocationContext<?> ctx, Object key, long time, TimeUnit unit)
It waits for any transaction with older topology id to complete that may have the lock forkey
acquired.PendingLockPromise
checkPendingTransactionsForKey(TxInvocationContext<?> ctx, Object key, long time, TimeUnit unit)
Same asawaitPendingTransactionsForKey(TxInvocationContext, Object, long, TimeUnit)
but non-blocking.PendingLockPromise
checkPendingTransactionsForKeys(TxInvocationContext<?> ctx, Collection<Object> keys, long time, TimeUnit unit)
Same asawaitPendingTransactionsForAllKeys(TxInvocationContext, Collection, long, TimeUnit)
but non-blocking.
-
-
-
Method Detail
-
checkPendingTransactionsForKey
PendingLockPromise checkPendingTransactionsForKey(TxInvocationContext<?> ctx, Object key, long time, TimeUnit unit)
Same asawaitPendingTransactionsForKey(TxInvocationContext, Object, long, TimeUnit)
but non-blocking.Multiple invocations with the same transaction returns the same
PendingLockPromise
. For cleanup purposes,awaitPendingTransactionsForKey(TxInvocationContext, Object, long, TimeUnit)
must be invoked afterwards.- Parameters:
ctx
- theTxInvocationContext
.key
- the key to check.time
- timeout.unit
-TimeUnit
oftime
.- Returns:
- a
PendingLockPromise
.
-
checkPendingTransactionsForKeys
PendingLockPromise checkPendingTransactionsForKeys(TxInvocationContext<?> ctx, Collection<Object> keys, long time, TimeUnit unit)
Same asawaitPendingTransactionsForAllKeys(TxInvocationContext, Collection, long, TimeUnit)
but non-blocking.Multiple invocations with the same transaction returns the same
PendingLockPromise
. For cleanup purposes,awaitPendingTransactionsForAllKeys(TxInvocationContext, Collection, long, TimeUnit)
must be invoked afterwards.- Parameters:
ctx
- theTxInvocationContext
.keys
- the keys to check.time
- timeout.unit
-TimeUnit
oftime
.- Returns:
- a
PendingLockPromise
.
-
awaitPendingTransactionsForKey
long awaitPendingTransactionsForKey(TxInvocationContext<?> ctx, Object key, long time, TimeUnit unit) throws InterruptedException
It waits for any transaction with older topology id to complete that may have the lock forkey
acquired.- Parameters:
ctx
- theTxInvocationContext
.key
- the key to check.time
- timeout.unit
-TimeUnit
oftime
.- Returns:
- the remaining timeout.
- Throws:
InterruptedException
- if the thread is interrupted while waiting.
-
awaitPendingTransactionsForAllKeys
long awaitPendingTransactionsForAllKeys(TxInvocationContext<?> ctx, Collection<Object> keys, long time, TimeUnit unit) throws InterruptedException
It waits for any transaction with older topology id to complete that may have the lock for any key inkeys
acquired.- Parameters:
ctx
- theTxInvocationContext
.keys
- the keys to check.time
- timeout.unit
-TimeUnit
oftime
.- Returns:
- the remaining timeout.
- Throws:
InterruptedException
- if the thread is interrupted while waiting.
-
-