Class QOSBasedMultiQueue<T extends QOSBasedRequestRunnable>

  • All Implemented Interfaces:
    SimpleQueue<T>

    public class QOSBasedMultiQueue<T extends QOSBasedRequestRunnable>
    extends AbstractQOSBasedQueue<T>
    A fair multi-queue based upon a ring topology. For each queue name, a separate queue exists and is inserted into the ring. Reading items from this queue involves examining each queue in order around the ring. The ring only grows in size but that is okay since the number of possible queues is a finite low number.
    • Constructor Detail

      • QOSBasedMultiQueue

        public QOSBasedMultiQueue()
      • QOSBasedMultiQueue

        public QOSBasedMultiQueue​(int maxPerQueue,
                                  java.util.Map<QOS,​java.lang.Integer> qosBasedAllocations)
      • QOSBasedMultiQueue

        public QOSBasedMultiQueue​(int maxPerQueue,
                                  int hardMaxPerQueue,
                                  java.util.Map<QOS,​java.lang.Integer> qosBasedAllocations)
    • Method Detail

      • getMaxPerQueue

        protected int getMaxPerQueue​(QOS qos)
        Returns a queue limit for a specified QOS.
        Parameters:
        qos - QOS.
        Returns:
        limit.
      • getRingEntry

        protected com.linkedin.alpini.base.queuing.QOSBasedMultiQueue.RingEntry getRingEntry​(java.lang.String queueName)
        Returns the ring entry for queueName or creates a new ring entry as required.
        Parameters:
        queueName - name of ring entry
        Returns:
        ring entry.
      • add

        public boolean add​(@Nonnull
                           T e)
        See Also:
        Queue.add(Object)
      • size

        public int size()
        See Also:
        Collection.size()
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: SimpleQueue
        Checks if queue is empty.
        Returns:
        true if Queue contains no elements, false otherwise.