Interface LockRepository

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
DefaultLockRepository

public interface LockRepository extends Closeable
Encapsulation of the SQL shunting that is needed for locks. A JdbcLockRegistry needs a reference to a spring-managed (transactional) client service, so this component has to be declared as a bean.
Since:
4.3
Author:
Dave Syer, Alexandre Strubel, Artem Bilan, Eddie Cho
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Acquire a lock for a key.
    void
     
    boolean
    delete(String lock)
    Remove a lock from this repository.
    void
    Remove all the expired locks.
    boolean
    Check if a lock is held by this repository.
    boolean
    renew(String lock)
    Renew the lease for a lock.
  • Method Details

    • isAcquired

      boolean isAcquired(String lock)
      Check if a lock is held by this repository.
      Parameters:
      lock - the lock to check.
      Returns:
      acquired or not.
    • delete

      boolean delete(String lock)
      Remove a lock from this repository.
      Parameters:
      lock - the lock to remove.
      Returns:
      deleted or not.
    • deleteExpired

      void deleteExpired()
      Remove all the expired locks.
    • acquire

      boolean acquire(String lock)
      Acquire a lock for a key.
      Parameters:
      lock - the key for lock to acquire.
      Returns:
      acquired or not.
    • renew

      boolean renew(String lock)
      Renew the lease for a lock.
      Parameters:
      lock - the lock to renew.
      Returns:
      renewed or not.
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable