Interface AsyncDistributedLock

All Superinterfaces:
AsyncPrimitive<AsyncDistributedLock,DistributedLock>, DistributedPrimitive

public interface AsyncDistributedLock extends AsyncPrimitive<AsyncDistributedLock,DistributedLock>
  • Method Details

    • lock

      Acquires the lock, blocking until it's available.
      Returns:
      future to be completed once the lock has been acquired
    • tryLock

      Attempts to acquire the lock.
      Returns:
      future to be completed with a boolean indicating whether the lock was acquired
    • tryLock

      default CompletableFuture<Boolean> tryLock(long timeout, TimeUnit unit)
      Attempts to acquire the lock.
      Parameters:
      timeout - the timeout after which to give up attempting to acquire the lock
      unit - the timeout time unit
      Returns:
      future to be completed with a boolean indicating whether the lock was acquired
    • tryLock

      CompletableFuture<Boolean> tryLock(Duration timeout)
      Attempts to acquire the lock for a specified amount of time.
      Parameters:
      timeout - the timeout after which to give up attempting to acquire the lock
      Returns:
      future to be completed with a boolean indicating whether the lock was acquired
    • unlock

      Unlocks the lock.
      Returns:
      future to be completed once the lock has been released
    • isLocked

      Query whether this lock is locked or not.
      Returns:
      future to be completed with a boolean indicating whether the lock was locked or not
    • sync

      default DistributedLock sync(Duration operationTimeout)
      Description copied from interface: AsyncPrimitive
      Returns a synchronous wrapper around the asynchronous primitive.
      Specified by:
      sync in interface AsyncPrimitive<AsyncDistributedLock,DistributedLock>
      Parameters:
      operationTimeout - the synchronous operation timeout
      Returns:
      the synchronous primitive