Class ThreadedStreamConsumer.QueueSynchronizer<T>

  • Type Parameters:
    T - element type in the queue
    Enclosing class:
    ThreadedStreamConsumer

    static class ThreadedStreamConsumer.QueueSynchronizer<T>
    extends java.lang.Object
    This synchronization helper mostly avoids the locks. If the queue size has reached zero or maxQueueSize then the threads are locked (parked/unparked). The thread instance T1 is reader (see the class "Pumper") and T2 is the writer (see the method "handleEvent").
    • Constructor Detail

      • QueueSynchronizer

        QueueSynchronizer​(int maxQueueSize,
                          T stopItemMarker)
    • Method Detail

      • markStopped

        void markStopped()
      • pushNext

        void pushNext​(T t)
      • awaitNext

        T awaitNext()
             throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • isEmptyQueue

        boolean isEmptyQueue()
      • clearQueue

        void clearQueue()
      • addNext

        private void addNext​(T t)