Interface ClusterLock

All Superinterfaces:
Lock

@PublicApi public interface ClusterLock extends Lock
Represents a cluster-wide lock.

These are named locks available from com.atlassian.beehive.ClusterLockService.

See Also:
  • Method Details

    • isHeldByCurrentThread

      boolean isHeldByCurrentThread()
      Queries if this lock is held by the current thread.

      This is equivalent to Thread.holdsLock(Object) for Java's intrinsic monitor locks or ReentrantLock.isHeldByCurrentThread().

      Returns:
      true if the current thread holds this lock; false otherwise
    • newCondition

      @Nonnull Condition newCondition()
      This optional operation from the java Lock interface is not supported in ClusterLock.
      Specified by:
      newCondition in interface Lock
      Returns:
      never
      Throws:
      UnsupportedOperationException - always
    • lockInterruptibly

      void lockInterruptibly() throws InterruptedException

      WARNING: ClusterLock supports interruption of this method on a best-effort basis only. All implementations will report interruption if the interrupted state exists prior to calling this method, but the underlying lock mechanism is not guaranteed to support interruption of an already in-flight lock request. The ability to interrupt a pending lockInterruptibly() call must not be relied upon for correctness.

      Specified by:
      lockInterruptibly in interface Lock
      Throws:
      InterruptedException - if this thread is interrupted before calling this method, or if this thread is interrupted while waiting for the lock and the implementation supports interruption.