Interface PendingLockPromise
-
public interface PendingLockPromise
A promise returned byPendingLockManager
.When a transaction need to wait for older topology transaction, this class allows it to check the state. If the transaction does not need to wait, or all older transactions have finished or have timed out, the
isReady()
method returnstrue
. Also, it allows the caller to add listeners to be notified when it is ready.- Since:
- 8.0
- Author:
- Pedro Ruivo
-
-
Field Summary
Fields Modifier and Type Field Description static PendingLockPromise
NO_OP
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addListener(PendingLockListener listener)
Adds a listener to this promise.long
getRemainingTimeout()
boolean
hasTimedOut()
boolean
isReady()
-
-
-
Field Detail
-
NO_OP
static final PendingLockPromise NO_OP
-
-
Method Detail
-
isReady
boolean isReady()
- Returns:
true
when the transaction has finished the waiting.
-
addListener
void addListener(PendingLockListener listener)
Adds a listener to this promise.The listener must be non-null and it is invoked only once. If
isReady()
returnstrue
, thelistener
is immediately invoked in the invoker thread.- Parameters:
listener
- thePendingLockListener
to add.
-
hasTimedOut
boolean hasTimedOut()
- Returns:
true
if the time out happened while waiting for older transactions.
-
getRemainingTimeout
long getRemainingTimeout()
- Returns:
- the remaining timeout. It is zero when
hasTimedOut()
istrue
.
-
-