Package org.opencms.util
Class CmsWaitHandle
java.lang.Object
org.opencms.util.CmsWaitHandle
Low-level utility class used for waiting for an action performed by another thread.
This is really a thin wrapper around the wait() and notifyAll() methods.
-
Constructor Summary
ConstructorDescriptionCreates a reusable wait handle.CmsWaitHandle
(boolean singleUse) Creates a wait handle. -
Method Summary
-
Constructor Details
-
CmsWaitHandle
public CmsWaitHandle()Creates a reusable wait handle. -
CmsWaitHandle
Creates a wait handle.The argument controls whether the wait handle will be single-use or reusable. The difference is that, for a single-use wait handle, all calls to enter() will return immediately after the first call to release(), while calling enter() on a reusable wait handle will always wait for the next release call.
- Parameters:
singleUse
- true if a single-use wait handle should be created
-
-
Method Details
-
enter
Waits for a maximum of waitTime, but returns if another thread calls release().- Parameters:
waitTime
- the maximum wait time
-
release
Releases all currently waiting threads.
-