Class CmsPriorityLock

java.lang.Object
org.opencms.util.CmsPriorityLock

public class CmsPriorityLock extends Object
Lock which can be acquired with two different priorities.

The lock can be only be held by one thread, but can be locked reentrantly by the owner. All waiting threads who requested the lock with high priority will be granted the lock first if it becomes available, before any threads who requested the lock with low priority.

  • Constructor Details

  • Method Details

    • lock

      public void lock(boolean highPriority)
      Acquire the lock, with given priority.
      Parameters:
      highPriority - true for high-priority acquisition, false for low-priority
    • unlock

      public void unlock()
      Releases the lock.
      Throws:
      IllegalMonitorStateException - if called by a thread not owning the lock