Interface AsyncDistributedLock

    • Method Detail

      • lock

        java.util.concurrent.CompletableFuture<Version> lock()
        Acquires the lock, blocking until it's available.
        Returns:
        future to be completed once the lock has been acquired
      • tryLock

        java.util.concurrent.CompletableFuture<java.util.Optional<Version>> tryLock()
        Attempts to acquire the lock.
        Returns:
        future to be completed with a boolean indicating whether the lock was acquired
      • tryLock

        java.util.concurrent.CompletableFuture<java.util.Optional<Version>> tryLock​(java.time.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

        java.util.concurrent.CompletableFuture<java.lang.Void> unlock()
        Unlocks the lock.
        Returns:
        future to be completed once the lock has been released