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
    • 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() returns true, the listener is immediately invoked in the invoker thread.

        Parameters:
        listener - the PendingLockListener to add.
      • hasTimedOut

        boolean hasTimedOut()
        Returns:
        true if the time out happened while waiting for older transactions.
      • getRemainingTimeout

        long getRemainingTimeout()
        Returns:
        the remaining timeout, in millis. It is zero when hasTimedOut() is true.