Class UnboundedQueue<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<E>
-
- 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
Constructors Constructor Description UnboundedQueue(int priority)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Object o)intdrainTo(Collection<? super E> c)Drain items from this queue to the specified collectionintdrainTo(Collection<? super E> c, int maxElements)Drain items from this queue to the specified collectionintgetCapacity()Return the capacity of the queueConditiongetNotFullCond()Get not full conditionintgetPriority()Get the Priority of the queueIterator<E>iterator()booleanoffer(E e)Epeek()Epoll()intremainingCapacity()Remaining capacity of the queue.booleanremove(Object o)voidsetNotFullCond(Condition condition)Get not full conditionvoidsetPriority(int p)Set the priorityintsize()-
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.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
-
-
-
Method Detail
-
iterator
public Iterator<E> iterator()
- Specified by:
iteratorin interfaceCollection<E>- Specified by:
iteratorin interfaceIterable<E>- Specified by:
iteratorin classAbstractCollection<E>
-
size
public int size()
- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein classAbstractCollection<E>
-
getPriority
public int getPriority()
Description copied from interface:InternalQueueGet the Priority of the queue- Specified by:
getPriorityin interfaceInternalQueue<E>- Returns:
- priority
-
setPriority
public void setPriority(int p)
Description copied from interface:InternalQueueSet the priority- Specified by:
setPriorityin interfaceInternalQueue<E>- Parameters:
p- priority
-
getNotFullCond
public Condition getNotFullCond()
Description copied from interface:InternalQueueGet not full condition- Specified by:
getNotFullCondin interfaceInternalQueue<E>- Returns:
- not full condition
-
setNotFullCond
public void setNotFullCond(Condition condition)
Description copied from interface:InternalQueueGet not full condition- Specified by:
setNotFullCondin interfaceInternalQueue<E>- Parameters:
condition- condition
-
drainTo
public int drainTo(Collection<? super E> c)
Description copied from interface:InternalQueueDrain items from this queue to the specified collection- Specified by:
drainToin interfaceInternalQueue<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:InternalQueueDrain items from this queue to the specified collection- Specified by:
drainToin interfaceInternalQueue<E>- Parameters:
c- collection to add itemmaxElements- maximum number of element to drain- Returns:
- number of items added
-
remainingCapacity
public int remainingCapacity()
Description copied from interface:InternalQueueRemaining capacity of the queue. Unbounded queues should return Integer.MAX_VALUE- Specified by:
remainingCapacityin interfaceInternalQueue<E>- Returns:
- remaining capacity
-
getCapacity
public int getCapacity()
Description copied from interface:InternalQueueReturn the capacity of the queue- Specified by:
getCapacityin interfaceInternalQueue<E>- Returns:
- capacity of thr queue
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<E>- Overrides:
containsin classAbstractCollection<E>
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<E>- Overrides:
removein classAbstractCollection<E>
-
-