Interface DistributedLockConnector


public interface DistributedLockConnector
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    acquire(@NotNull com.coditory.sherlock.LockRequest lockRequest)
    Acquire a lock.
    boolean
    acquireOrProlong(@NotNull com.coditory.sherlock.LockRequest lockRequest)
    Acquire a lock or prolong it if it was acquired by the same instance.
    boolean
    forceAcquire(@NotNull com.coditory.sherlock.LockRequest lockRequest)
    Acquire a lock even if it was already acquired by someone else
    boolean
    forceRelease(@NotNull String lockId)
    Release a lock without checking its owner or release date.
    boolean
    Release all locks without checking their owners or release dates.
    void
    Initializes underlying infrastructure for locks.
    boolean
    release(@NotNull String lockId, @NotNull String ownerId)
    Unlock a lock if wat acquired by the same instance.
  • Method Details

    • initialize

      void initialize()
      Initializes underlying infrastructure for locks. Most frequently triggers database table creation and index creation.

      If it is not executed explicitly, connector may execute it during first acquire acquisition or release.

    • acquire

      boolean acquire(@NotNull @NotNull com.coditory.sherlock.LockRequest lockRequest)
      Acquire a lock.
      Returns:
      boolean - true if acquire was acquired by this call
    • acquireOrProlong

      boolean acquireOrProlong(@NotNull @NotNull com.coditory.sherlock.LockRequest lockRequest)
      Acquire a lock or prolong it if it was acquired by the same instance.
      Returns:
      boolean - true if acquire was acquired by this call
    • forceAcquire

      boolean forceAcquire(@NotNull @NotNull com.coditory.sherlock.LockRequest lockRequest)
      Acquire a lock even if it was already acquired by someone else
      Returns:
      boolean - true if acquire was acquired by this call
    • release

      boolean release(@NotNull @NotNull String lockId, @NotNull @NotNull String ownerId)
      Unlock a lock if wat acquired by the same instance.
      Returns:
      boolean - true if acquire was released by this call
    • forceRelease

      boolean forceRelease(@NotNull @NotNull String lockId)
      Release a lock without checking its owner or release date.
      Returns:
      boolean - true if acquire was released by this call
    • forceReleaseAll

      boolean forceReleaseAll()
      Release all locks without checking their owners or release dates.
      Returns:
      boolean - true if at least one lock was released