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 Optional<Version> tryLock​(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