Class PRRNextQueueAlgorithm<E>

  • All Implemented Interfaces:
    NextQueueAlgorithm<E>

    public class PRRNextQueueAlgorithm<E>
    extends Object
    implements NextQueueAlgorithm<E>
    This is a priority based round robin algorithm for getting the next queue

    This algorithm works in cycles. Lets say we have queues with following priorities. 7, 5, 2 and assume we name the queues as 1, 2, 3 in the order.

    Here is how messages are picked in a single cycle

    1, 1, 1, 1, 1, 1, 1 all the messages for the queue with priority 1 are sent for this cycle 2, 2, 2, 2, 2, all the messages for the queue with priority 2 are sent for this cycle 3, 3 all the messages with priority 2 are sent for this cycle

    This algorithm choose the queues in the above order if all the queues have messages at the point of selection. If a queue doesn't have messages it will skip the queue and move to the next. If none of the queues have messages it will return null.

    • Constructor Detail

      • PRRNextQueueAlgorithm

        public PRRNextQueueAlgorithm()