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:
    Iterable<E>, Collection<E>, Queue<E>, InternalQueue<E>

      public class FixedSizeQueue<E>
      extends 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(Object o)`
    `int` | `drainTo(Collection<? super E> c)` Drain items from this queue to the specified collection
    `int` | `drainTo(Collection<? super E> c, int maxElements)` Drain items from this queue to the specified collection
    `int` | `getCapacity()` Return the capacity of the queue
    `Condition` | `getNotFullCond()` Get not full condition
    `int` | `getPriority()` Get the Priority of the queue
    `Iterator<E>` | `iterator()`
    `boolean` | `offer(E e)`
    `E` | `peek()`
    `E` | `poll()`
    `int` | `remainingCapacity()` Remaining capacity of the queue.
    `boolean` | `remove(Object o)`
    `void` | `setNotFullCond(Condition notFullCond)` Get not full condition
    `void` | `setPriority(int p)` Set the priority
    `int` | `size()`
    `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 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(Condition notFullCond)

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

    - #### iterator

          public Iterator<E> iterator()

      Specified by:
        `iterator` in interface `Iterable<E>`
      Specified by:
        `iterator` in interface `Collection<E>`
      Specified by:
        `iterator` in class `AbstractCollection<E>`

    - #### size

          public int size()

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

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `AbstractCollection<E>`

    - #### offer

          public boolean offer(E e)

      Specified by:
        `offer` in interface `Queue<E>`

    - #### poll

          public E poll()

      Specified by:
        `poll` in interface `Queue<E>`

    - #### peek

          public E peek()

      Specified by:
        `peek` in interface `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(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(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(Object o)

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

    - #### remove

          public boolean remove(Object o)

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

Copyright © 2005–2019 Apache Software Foundation. All rights reserved.