public class PRRNextQueueAlgorithm<E> extends Object implements NextQueueAlgorithm<E>
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 and Description |
---|
PRRNextQueueAlgorithm() |
Modifier and Type | Method and Description |
---|---|
InternalQueue<E> |
getNextQueue()
Should return a queue based on some selection criteria and current
state of the queues.
|
void |
init(List<InternalQueue<E>> queues)
Initialized with the queues sorted according to the priority.
|
public InternalQueue<E> getNextQueue()
NextQueueAlgorithm
getNextQueue
in interface NextQueueAlgorithm<E>
public void init(List<InternalQueue<E>> queues)
NextQueueAlgorithm
init
in interface NextQueueAlgorithm<E>
queues
- list of queuesCopyright © 2005-2017 Apache Software Foundation. All Rights Reserved.