Class PRRNextQueueAlgorithm<E>
java.lang.Object
org.apache.synapse.commons.executors.PRRNextQueueAlgorithm<E>
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionShould return a queue based on some selection criteria and current state of the queues.voidinit(List<InternalQueue<E>> queues) Initialized with the queues sorted according to the priority.
-
Constructor Details
-
PRRNextQueueAlgorithm
public PRRNextQueueAlgorithm()
-
-
Method Details
-
getNextQueue
Description copied from interface:NextQueueAlgorithmShould return a queue based on some selection criteria and current state of the queues.- Specified by:
getNextQueuein interfaceNextQueueAlgorithm<E>- Returns:
- the queue
-
init
Description copied from interface:NextQueueAlgorithmInitialized with the queues sorted according to the priority.- Specified by:
initin interfaceNextQueueAlgorithm<E>- Parameters:
queues- list of queues
-