Interface PendingLockPromise
public interface PendingLockPromise
A promise returned by
PendingLockManager.
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 returns true. Also, it allows the caller to add listeners to be notified when it is ready.
- Since:
- 8.0
- Author:
- Pedro Ruivo
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(PendingLockListener listener) Adds a listener to this promise.longbooleanbooleanisReady()If successful,getRemainingTimeout()will return the remaining timeout, in millis.
-
Field Details
-
NO_OP
-
-
Method Details
-
isReady
boolean isReady()- Returns:
truewhen the transaction has finished the waiting.
-
addListener
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, in millis. It is zero when
hasTimedOut()istrue.
-
toInvocationStage
InvocationStage toInvocationStage()If successful,getRemainingTimeout()will return the remaining timeout, in millis. If timed out, the resultInvocationStagewill be completed with aTimeoutException.- Returns:
- an
InvocationStagefor this lock.
-