Class WaitQueue.Standard

  • All Implemented Interfaces:
    WaitQueue
    Enclosing interface:
    WaitQueue

    public static class WaitQueue.Standard
    extends java.lang.Object
    implements WaitQueue
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Standard()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getWaiting()
      Return how many threads are waiting
      boolean hasWaiters()
      getWaiting() > 0
      WaitQueue.Signal register()
      The calling thread MUST be the thread that uses the signal
      <V> WaitQueue.Signal register​(V supplyOnDone, java.util.function.Consumer<V> receiveOnDone)
      The calling thread MUST be the thread that uses the signal.
      boolean signal()
      Signal one waiting thread
      void signalAll()
      Signal all waiting threads
      • Methods inherited from class java.lang.Object

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

      • Standard

        protected Standard()
    • Method Detail

      • register

        public WaitQueue.Signal register()
        The calling thread MUST be the thread that uses the signal
        Specified by:
        register in interface WaitQueue
        Returns:
        x
      • register

        public <V> WaitQueue.Signal register​(V supplyOnDone,
                                             java.util.function.Consumer<V> receiveOnDone)
        The calling thread MUST be the thread that uses the signal. If the Signal is waited on, context.stop() will be called when the wait times out, the Signal is signalled, or the waiting thread is interrupted.
        Specified by:
        register in interface WaitQueue
      • signal

        public boolean signal()
        Signal one waiting thread
        Specified by:
        signal in interface WaitQueue
      • signalAll

        public void signalAll()
        Signal all waiting threads
        Specified by:
        signalAll in interface WaitQueue
      • hasWaiters

        public boolean hasWaiters()
        Description copied from interface: WaitQueue
        getWaiting() > 0
        Specified by:
        hasWaiters in interface WaitQueue
      • getWaiting

        public int getWaiting()
        Description copied from interface: WaitQueue
        Return how many threads are waiting
        Specified by:
        getWaiting in interface WaitQueue
        Returns:
        how many threads are waiting