Class SyncProcessingQueue<T>


  • public class SyncProcessingQueue<T>
    extends Object
    Multiple producer-single consumer queue. The producers are expected to call pushAndWait(), the consumer should call pop() in a loop and if a null is returned (meaning that the queue is either empty or the limit of elements processed in a loop has been reached, to call notifyAndWait(). Example: while (running) { T element = queue.pop(); if (element != null) { process(element); } else { flush(); queue.notifyAndWait(); } } // terminate producers and process the rest of the queue queue.notifyNoWait();
    Author:
    Radim Vansa <rvansa@redhat.com>
    • Constructor Detail

      • SyncProcessingQueue

        public SyncProcessingQueue()
      • SyncProcessingQueue

        public SyncProcessingQueue​(int maxPoppedInRow)