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 java.lang.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 java.lang.String` | `NONPRIORITY_QUEUE` |
    `static java.lang.String` | `QUEUE_IMPLEMENTATION` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PriorityQueueAbstract()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static <E> PriorityQueueAbstract<E>` | `getPriorityQueue​(int maxPriority, int maxSize)` | Deprecated.
    `static <E> PriorityQueueAbstract<E>` | `getPriorityQueue​(int maxPriority, int maxSize, java.lang.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 Detail

    - #### NONPRIORITY_QUEUE

          public static final java.lang.String NONPRIORITY_QUEUE

      See Also:
        Constant Field Values

    - #### QUEUE_IMPLEMENTATION

          public static final java.lang.String QUEUE_IMPLEMENTATION

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PriorityQueueAbstract

          public PriorityQueueAbstract()

  - ### Method Detail

    - #### getPriorityQueue

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

      Deprecated.

    - #### getPriorityQueue

          public static <E> PriorityQueueAbstract<E> getPriorityQueue​(int maxPriority,
                                                                      int maxSize,
                                                                      java.lang.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 java.lang.InterruptedException

      Throws:
        `java.lang.InterruptedException`

    - #### setMaxSize

          public abstract void setMaxSize​(int maxSize)

    - #### size

          public abstract int[] size()

    - #### take

          public abstract E take()
                          throws java.lang.InterruptedException

      Throws:
        `java.lang.InterruptedException`

    - #### totalSize

          public abstract int totalSize()