Package org.opencms.util
Class CmsPriorityLock
java.lang.Object
org.opencms.util.CmsPriorityLock
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 Summary
Constructors -
Method Summary
-
Constructor Details
-
CmsPriorityLock
public CmsPriorityLock()Creates a new instance.
-
-
Method Details
-
lock
Acquire the lock, with given priority.- Parameters:
highPriority
- true for high-priority acquisition, false for low-priority
-
unlock
Releases the lock.- Throws:
IllegalMonitorStateException
- if called by a thread not owning the lock
-