Class ProcessingQueue<T>


  • public class ProcessingQueue<T>
    extends java.lang.Object
    A queue with many producers and consumers. However, only one consumer gets to remove and process elements at any given time. This is done through the use of locks.
    Since:
    3.5
    Author:
    Bela Ban
    • Field Detail

      • queue

        protected final java.util.Queue<T> queue
      • producer_lock

        protected final java.util.concurrent.locks.ReentrantLock producer_lock
      • consumer_lock

        protected final java.util.concurrent.locks.ReentrantLock consumer_lock
      • count

        protected int count
    • Constructor Detail

      • ProcessingQueue

        public ProcessingQueue()
    • Method Detail

      • getQueue

        public java.util.Queue<T> getQueue()
      • size

        public int size()
      • add

        public void add​(T element)
      • retainAll

        public boolean retainAll​(java.util.Collection<T> elements)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • process

        protected void process()