org.apache.synapse.commons.executors.queues
Class UnboundedQueue<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue<E>
          extended by org.apache.synapse.commons.executors.queues.UnboundedQueue<E>
Type Parameters:
E -
All Implemented Interfaces:
Iterable<E>, Collection<E>, Queue<E>, InternalQueue<E>

public class UnboundedQueue<E>
extends AbstractQueue<E>
implements InternalQueue<E>

An unbounded queue backed by and ArrayList.


Constructor Summary
UnboundedQueue(int priority)
           
 
Method Summary
 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 condition)
          Get not full condition
 void setPriority(int p)
          Set the priority
 int size()
           
 
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, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Queue
element, remove
 
Methods inherited from interface java.util.Collection
add, addAll, clear, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
 

Constructor Detail

UnboundedQueue

public UnboundedQueue(int priority)
Method Detail

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>

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>

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 condition)
Description copied from interface: InternalQueue
Get not full condition

Specified by:
setNotFullCond in interface InternalQueue<E>
Parameters:
condition - condition

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

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

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-2012 Apache Software Foundation. All Rights Reserved.