Package tigase.util.workqueue

# Class PriorityQueueAbstract<E>

java.lang.Object
tigase.util.workqueue.PriorityQueueAbstract<E>

Direct Known Subclasses:
  `NonpriorityQueue`, `PriorityQueueRelaxed`, `PriorityQueueStrict`

public abstract class PriorityQueueAbstract<E> extends Object
Works like a LinkedBlockingQueue using the put() and take() methods but with an additional priority integer parameter. The elemnt returned from take() will honor the priority in such a way that all elements of a lower priority will be returned before any elemens of a higher priority.
Modified proposition taken from Noa Resare: http://resare.com/noa/ref/MultiPrioQueue.java

Author:
  Artur Hefczyc

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `NONPRIORITY_QUEUE`
  `static final String`
  `QUEUE_IMPLEMENTATION`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PriorityQueueAbstract()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static <E> PriorityQueueAbstract<E>`
  `getPriorityQueue(int maxPriority, int maxSize)`
  Deprecated.
  `static <E> PriorityQueueAbstract<E>`
  `getPriorityQueue(int maxPriority, int maxSize, Class<? extends PriorityQueueAbstract> queueClass)`
  `abstract void`
  `init(int maxPriority, int maxSize)`
  `abstract boolean`
  `offer(E element, int priority)`
  `abstract void`
  `put(E element, int priority)`
  `abstract void`
  `setMaxSize(int maxSize)`
  `abstract int[]`
  `size()`
  `abstract E`
  `take()`
  `abstract int`
  `totalSize()`

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

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

- ## Field Details

  - ### NONPRIORITY_QUEUE

    public static final String NONPRIORITY_QUEUE
    See Also:
      - Constant Field Values

  - ### QUEUE_IMPLEMENTATION

    public static final String QUEUE_IMPLEMENTATION
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### PriorityQueueAbstract

    public PriorityQueueAbstract()

- ## Method Details

  - ### getPriorityQueue

    @Deprecated public static <E> PriorityQueueAbstract<E> getPriorityQueue(int maxPriority, int maxSize)
    Deprecated.

  - ### getPriorityQueue

    public static <E> PriorityQueueAbstract<E> getPriorityQueue(int maxPriority, int maxSize, Class<? extends PriorityQueueAbstract> queueClass)

  - ### init

    public abstract void init(int maxPriority, int maxSize)

  - ### offer

    public abstract boolean offer(E element, int priority)

  - ### put

    public abstract void put(E element, int priority) throws InterruptedException
    Throws:
      `InterruptedException`

  - ### setMaxSize

    public abstract void setMaxSize(int maxSize)

  - ### size

    public abstract int[] size()

  - ### take

    public abstract E take() throws InterruptedException
    Throws:
      `InterruptedException`

  - ### totalSize

    public abstract int totalSize()