Class MultiPriorityBlockingQueue<E>

  • Type Parameters:
    E - E should implement the Importance interface.
    All Implemented Interfaces:
    Iterable<E>, Collection<E>, BlockingQueue<E>, Queue<E>

    public class MultiPriorityBlockingQueue<E>
    extends AbstractQueue<E>
    implements BlockingQueue<E>
    This queue implements the BlockingQueue interface. The element should implement the Importance interface.

    Internally Queue is implemented as a set of multiple queues corresponding to some fixed priorities. When inserting an element, it will be put in to one of these queues depending on its importance.

    • Constructor Detail

      • MultiPriorityBlockingQueue

        public MultiPriorityBlockingQueue​(List<InternalQueue<E>> queues,
                                          boolean isFixedQueues,
                                          NextQueueAlgorithm<E> algorithm)
        Create a queue with the given queues.

        This method will create a Queue that accepts objects with only the priorities specified. If a object is submitted with a different priority it will result in an IllegalArgumentException. If the algorithm is null, this queue will use the PRRNextQueueAlgorithm.

        Parameters:
        queues - list of InternalQueue to be used
        isFixedQueues - weather fixed size queues are used
        algorithm - algorithm for calculating next queue