Interface PendingLockPromise
-
public interface PendingLockPromiseA 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 PendingLockPromiseNO_OP
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddListener(PendingLockListener listener)Adds a listener to this promise.longgetRemainingTimeout()booleanhasTimedOut()booleanisReady()
-
-
-
Field Detail
-
NO_OP
static final PendingLockPromise NO_OP
-
-
Method Detail
-
isReady
boolean isReady()
- Returns:
truewhen 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, thelisteneris immediately invoked in the invoker thread.- Parameters:
listener- thePendingLockListenerto add.
-
hasTimedOut
boolean hasTimedOut()
- Returns:
trueif the time out happened while waiting for older transactions.
-
getRemainingTimeout
long getRemainingTimeout()
- Returns:
- the remaining timeout. It is zero when
hasTimedOut()istrue.
-
-