Class CmsWaitHandle

java.lang.Object
org.opencms.util.CmsWaitHandle

public class CmsWaitHandle extends Object
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 Details

    • CmsWaitHandle

      public CmsWaitHandle()
      Creates a reusable wait handle.

    • CmsWaitHandle

      public CmsWaitHandle(boolean singleUse)
      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

      public void enter(long waitTime)
      Waits for a maximum of waitTime, but returns if another thread calls release().

      Parameters:
      waitTime - the maximum wait time
    • release

      public void release()
      Releases all currently waiting threads.