Class DefaultDistributedLock

    • Constructor Detail

      • DefaultDistributedLock

        public DefaultDistributedLock​(AsyncDistributedLock asyncLock,
                                      long operationTimeoutMillis)
    • Method Detail

      • lock

        public Version lock()
        Description copied from interface: DistributedLock
        Acquires the lock, blocking until it's available.
        Specified by:
        lock in interface DistributedLock
        Returns:
        the acquired lock version
      • tryLock

        public java.util.Optional<Version> tryLock()
        Description copied from interface: DistributedLock
        Attempts to acquire the lock.
        Specified by:
        tryLock in interface DistributedLock
        Returns:
        indicates whether the lock was acquired
      • tryLock

        public java.util.Optional<Version> tryLock​(java.time.Duration timeout)
        Description copied from interface: DistributedLock
        Attempts to acquire the lock for a specified amount of time.
        Specified by:
        tryLock in interface DistributedLock
        Parameters:
        timeout - the timeout after which to give up attempting to acquire the lock
        Returns:
        indicates whether the lock was acquired