org.apache.synapse.commons.executors.queues

## Class FixedSizeQueue<E>

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractQueue<E>
    - - org.apache.synapse.commons.executors.queues.FixedSizeQueue<E>

- Type Parameters:
    `E` - Should implement the Importance interface
  All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>, java.util.Queue<E>, InternalQueue<E>

      public class FixedSizeQueue<E>
      extends java.util.AbstractQueue<E>
      implements InternalQueue<E>

  A bounded queue implementation for internal queues. This queue is backed by an fixed size array.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FixedSizeQueue(int priority, int capacity)` Create a queue with the given priority and capacity.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(java.lang.Object o)`
    `int` | `drainTo(java.util.Collection<? super E> c)` Drain items from this queue to the specified collection
    `int` | `drainTo(java.util.Collection<? super E> c, int maxElements)` Drain items from this queue to the specified collection
    `int` | `getCapacity()` Return the capacity of the queue
    `java.util.concurrent.locks.Condition` | `getNotFullCond()` Get not full condition
    `int` | `getPriority()` Get the Priority of the queue
    `java.util.Iterator<E>` | `iterator()`
    `boolean` | `offer(E e)`
    `E` | `peek()`
    `E` | `poll()`
    `int` | `remainingCapacity()` Remaining capacity of the queue.
    `boolean` | `remove(java.lang.Object o)`
    `void` | `setNotFullCond(java.util.concurrent.locks.Condition notFullCond)` Get not full condition
    `void` | `setPriority(int p)` Set the priority
    `int` | `size()`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.util.AbstractQueue

      `add, addAll, clear, element, remove`

    - ### Methods inherited from class java.util.AbstractCollection

      `containsAll, isEmpty, removeAll, retainAll, toArray, toArray`

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

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

    - ### Methods inherited from interface java.util.Queue

      `add, element, remove`

    - ### Methods inherited from interface java.util.Collection

      `addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

- - ### Constructor Detail

    - #### FixedSizeQueue

          public FixedSizeQueue(int priority,
                                int capacity)

      Create a queue with the given priority and capacity.
      Parameters:
        `priority` - priority of the elements in the queue
        `capacity` - capacity of the queue

  - ### Method Detail

    - #### getPriority

          public int getPriority()

      Description copied from interface: `InternalQueue`
      Get the Priority of the queue
      Specified by:
        `getPriority` in interface `InternalQueue<E>`
      Returns:
        priority

    - #### setPriority

          public void setPriority(int p)

      Description copied from interface: `InternalQueue`
      Set the priority
      Specified by:
        `setPriority` in interface `InternalQueue<E>`
      Parameters:
        `p` - priority

    - #### getNotFullCond

          public java.util.concurrent.locks.Condition getNotFullCond()

      Description copied from interface: `InternalQueue`
      Get not full condition
      Specified by:
        `getNotFullCond` in interface `InternalQueue<E>`
      Returns:
        not full condition

    - #### setNotFullCond

          public void setNotFullCond(java.util.concurrent.locks.Condition notFullCond)

      Description copied from interface: `InternalQueue`
      Get not full condition
      Specified by:
        `setNotFullCond` in interface `InternalQueue<E>`
      Parameters:
        `notFullCond` - condition

    - #### iterator

          public java.util.Iterator<E> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<E>`
      Specified by:
        `iterator` in interface `java.util.Collection<E>`
      Specified by:
        `iterator` in class `java.util.AbstractCollection<E>`

    - #### size

          public int size()

      Specified by:
        `size` in interface `java.util.Collection<E>`
      Specified by:
        `size` in class `java.util.AbstractCollection<E>`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.util.AbstractCollection<E>`

    - #### offer

          public boolean offer(E e)

      Specified by:
        `offer` in interface `java.util.Queue<E>`

    - #### poll

          public E poll()

      Specified by:
        `poll` in interface `java.util.Queue<E>`

    - #### peek

          public E peek()

      Specified by:
        `peek` in interface `java.util.Queue<E>`

    - #### remainingCapacity

          public int remainingCapacity()

      Description copied from interface: `InternalQueue`
      Remaining capacity of the queue. Unbounded queues should return Integer.MAX_VALUE
      Specified by:
        `remainingCapacity` in interface `InternalQueue<E>`
      Returns:
        remaining capacity

    - #### drainTo

          public int drainTo(java.util.Collection<? super E> c)

      Description copied from interface: `InternalQueue`
      Drain items from this queue to the specified collection
      Specified by:
        `drainTo` in interface `InternalQueue<E>`
      Parameters:
        `c` - collection to add item
      Returns:
        number of items added

    - #### drainTo

          public int drainTo(java.util.Collection<? super E> c,
                             int maxElements)

      Description copied from interface: `InternalQueue`
      Drain items from this queue to the specified collection
      Specified by:
        `drainTo` in interface `InternalQueue<E>`
      Parameters:
        `c` - collection to add item
        `maxElements` - maximum number of element to drain
      Returns:
        number of items added

    - #### getCapacity

          public int getCapacity()

      Description copied from interface: `InternalQueue`
      Return the capacity of the queue
      Specified by:
        `getCapacity` in interface `InternalQueue<E>`
      Returns:
        capacity of thr queue

    - #### contains

          public boolean contains(java.lang.Object o)

      Specified by:
        `contains` in interface `java.util.Collection<E>`
      Overrides:
        `contains` in class `java.util.AbstractCollection<E>`

    - #### remove

          public boolean remove(java.lang.Object o)

      Specified by:
        `remove` in interface `java.util.Collection<E>`
      Overrides:
        `remove` in class `java.util.AbstractCollection<E>`

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