org.apache.synapse.commons.executors

## Class PRRNextQueueAlgorithm<E>

- java.lang.Object
- - org.apache.synapse.commons.executors.PRRNextQueueAlgorithm<E>

- All Implemented Interfaces:
    NextQueueAlgorithm<E>

      public class PRRNextQueueAlgorithm<E>
      extends java.lang.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 Summary

    Constructors
    Constructor and Description
    `PRRNextQueueAlgorithm()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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(java.util.List<InternalQueue<E>> queues)` Initialized with the queues sorted according to the priority.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PRRNextQueueAlgorithm

          public PRRNextQueueAlgorithm()

  - ### Method Detail

    - #### getNextQueue

          public InternalQueue<E> getNextQueue()

      Description copied from interface: `NextQueueAlgorithm`
      Should return a queue based on some selection criteria and current state of the queues.
      Specified by:
        `getNextQueue` in interface `NextQueueAlgorithm<E>`
      Returns:
        the queue

    - #### init

          public void init(java.util.List<InternalQueue<E>> queues)

      Description copied from interface: `NextQueueAlgorithm`
      Initialized with the queues sorted according to the priority.
      Specified by:
        `init` in interface `NextQueueAlgorithm<E>`
      Parameters:
        `queues` - list of queues

Copyright © 2005-2022 Apache Software Foundation. All Rights Reserved.