Class CmsWaitHandle


  • public class CmsWaitHandle
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      CmsWaitHandle()
      Creates a reusable wait handle.
      CmsWaitHandle​(boolean singleUse)
      Creates a wait handle.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void enter​(long waitTime)
      Waits for a maximum of waitTime, but returns if another thread calls release().
      void release()
      Releases all currently waiting threads.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • 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.