Interface RLockAsync

    • Method Detail

      • forceUnlockAsync

        RFuture<Boolean> forceUnlockAsync()
        Unlocks the lock independently of its state
        Returns:
        true if lock existed and now unlocked otherwise false
      • unlockAsync

        RFuture<Void> unlockAsync()
        Unlocks the lock
        Returns:
        void
      • unlockAsync

        RFuture<Void> unlockAsync​(long threadId)
        Unlocks the lock. Throws IllegalMonitorStateException if lock isn't locked by thread with specified threadId.
        Parameters:
        threadId - id of thread
        Returns:
        void
      • tryLockAsync

        RFuture<Boolean> tryLockAsync()
        Tries to acquire the lock.
        Returns:
        true if lock acquired otherwise false
      • lockAsync

        RFuture<Void> lockAsync()
        Acquires the lock. Waits if necessary until lock became available.
        Returns:
        void
      • lockAsync

        RFuture<Void> lockAsync​(long threadId)
        Acquires the lock by thread with defined threadId. Waits if necessary until lock became available.
        Parameters:
        threadId - id of thread
        Returns:
        void
      • lockAsync

        RFuture<Void> lockAsync​(long leaseTime,
                                TimeUnit unit)
        Acquires the lock with defined leaseTime. Waits if necessary until lock became available. Lock will be released automatically after defined leaseTime interval.
        Parameters:
        leaseTime - the maximum time to hold the lock after it's acquisition, if it hasn't already been released by invoking unlock. If leaseTime is -1, hold the lock until explicitly unlocked.
        unit - the time unit
        Returns:
        void
      • lockAsync

        RFuture<Void> lockAsync​(long leaseTime,
                                TimeUnit unit,
                                long threadId)
        Acquires the lock with defined leaseTime and threadId. Waits if necessary until lock became available. Lock will be released automatically after defined leaseTime interval.
        Parameters:
        leaseTime - the maximum time to hold the lock after it's acquisition, if it hasn't already been released by invoking unlock. If leaseTime is -1, hold the lock until explicitly unlocked.
        unit - the time unit
        threadId - id of thread
        Returns:
        void
      • tryLockAsync

        RFuture<Boolean> tryLockAsync​(long threadId)
        Tries to acquire the lock by thread with specified threadId.
        Parameters:
        threadId - id of thread
        Returns:
        true if lock acquired otherwise false
      • tryLockAsync

        RFuture<Boolean> tryLockAsync​(long waitTime,
                                      TimeUnit unit)
        Tries to acquire the lock. Waits up to defined waitTime if necessary until the lock became available.
        Parameters:
        waitTime - the maximum time to acquire the lock
        unit - time unit
        Returns:
        true if lock is successfully acquired, otherwise false if lock is already set.
      • tryLockAsync

        RFuture<Boolean> tryLockAsync​(long waitTime,
                                      long leaseTime,
                                      TimeUnit unit)
        Tries to acquire the lock with defined leaseTime. Waits up to defined waitTime if necessary until the lock became available. Lock will be released automatically after defined leaseTime interval.
        Parameters:
        waitTime - the maximum time to acquire the lock
        leaseTime - lease time
        unit - time unit
        Returns:
        true if lock is successfully acquired, otherwise false if lock is already set.
      • tryLockAsync

        RFuture<Boolean> tryLockAsync​(long waitTime,
                                      long leaseTime,
                                      TimeUnit unit,
                                      long threadId)
        Tries to acquire the lock by thread with specified threadId and leaseTime. Waits up to defined waitTime if necessary until the lock became available. Lock will be released automatically after defined leaseTime interval.
        Parameters:
        threadId - id of thread
        waitTime - time interval to acquire lock
        leaseTime - time interval after which lock will be released automatically
        unit - the time unit of the waitTime and leaseTime arguments
        Returns:
        true if lock acquired otherwise false
      • getHoldCountAsync

        RFuture<Integer> getHoldCountAsync()
        Number of holds on this lock by the current thread
        Returns:
        holds or 0 if this lock is not held by current thread
      • isLockedAsync

        RFuture<Boolean> isLockedAsync()
        Checks if the lock locked by any thread
        Returns:
        true if locked otherwise false
      • remainTimeToLiveAsync

        RFuture<Long> remainTimeToLiveAsync()
        Remaining time to live of the lock
        Returns:
        time in milliseconds -2 if the lock does not exist. -1 if the lock exists but has no associated expire.