Interface SimpleLock

All Known Implementing Classes:
AbstractSimpleLock

public interface SimpleLock
  • Method Details

    • unlock

      void unlock()
      Unlocks the lock. Once you unlock it, you should not use for any other operation.
      Throws:
      IllegalStateException - if the lock has already been unlocked or extended
    • extend

      @Deprecated default Optional<SimpleLock> extend​(Instant lockAtMostUntil, Instant lockAtLeastUntil)
      Deprecated.
      Extends the lock. If the lock can be extended a new lock is returned. After calling extend, no other operation can be called on current lock.

      This method is NOT supported by all lock providers.

      Returns:
      a new lock or empty optional if the lock can not be extended
      Throws:
      IllegalStateException - if the lock has already been unlocked or extended
      UnsupportedOperationException - if the lock extension is not supported by LockProvider.
    • extend

      default Optional<SimpleLock> extend​(Duration lockAtMostFor, Duration lockAtLeastFor)
      Extends the lock. If the lock can be extended a new lock is returned. After calling extend, no other operation can be called on current lock.

      This method is NOT supported by all lock providers.

      Returns:
      a new lock or empty optional if the lock can not be extended
      Throws:
      IllegalStateException - if the lock has already been unlocked or extended
      UnsupportedOperationException - if the lock extension is not supported by LockProvider.