|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
org.eclipse.jetty.util.BlockingArrayQueue<E>
E - The element typepublic class BlockingArrayQueue<E>
Queue backed by a circular array.
This queue is uses a variant of the two lock queue algorithm to
provide an efficient queue or list backed by a growable circular
array. This queue also has a partial implementation of
BlockingQueue, specifically the take() and
poll(long, TimeUnit) methods.
Unlike ArrayBlockingQueue, this class is
able to grow and provides a blocking put call.
The queue has both a capacity (the size of the array currently allocated)
and a limit (the maximum size that may be allocated), which defaults to
Integer.MAX_VALUE.
| Field Summary | |
|---|---|
int |
DEFAULT_CAPACITY
|
int |
DEFAULT_GROWTH
|
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
BlockingArrayQueue()
Create a growing partially blocking Queue |
|
BlockingArrayQueue(int limit)
Create a fixed size partially blocking Queue |
|
BlockingArrayQueue(int capacity,
int growBy)
Create a growing partially blocking Queue. |
|
BlockingArrayQueue(int capacity,
int growBy,
int limit)
Create a growing limited partially blocking Queue. |
|
| Method Summary | |
|---|---|
boolean |
add(E e)
|
void |
add(int index,
E e)
|
void |
clear()
|
int |
drainTo(java.util.Collection<? super E> c)
|
int |
drainTo(java.util.Collection<? super E> c,
int maxElements)
|
E |
element()
|
E |
get(int index)
|
int |
getCapacity()
|
int |
getLimit()
|
boolean |
isEmpty()
|
boolean |
offer(E e)
|
boolean |
offer(E o,
long timeout,
java.util.concurrent.TimeUnit unit)
|
E |
peek()
|
E |
poll()
|
E |
poll(long time,
java.util.concurrent.TimeUnit unit)
Retrieves and removes the head of this queue, waiting if necessary up to the specified wait time if no elements are present on this queue. |
void |
put(E o)
|
int |
remainingCapacity()
|
E |
remove()
|
E |
remove(int index)
|
E |
set(int index,
E e)
|
int |
size()
|
E |
take()
Retrieves and removes the head of this queue, waiting if no elements are present on this queue. |
| Methods inherited from class java.util.AbstractList |
|---|
addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
addAll, contains, containsAll, equals, hashCode, iterator, remove, removeAll, retainAll, toArray, toArray |
| Methods inherited from interface java.util.List |
|---|
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray |
| Field Detail |
|---|
public final int DEFAULT_CAPACITY
public final int DEFAULT_GROWTH
| Constructor Detail |
|---|
public BlockingArrayQueue()
public BlockingArrayQueue(int limit)
limit - The initial capacity and the limit.
public BlockingArrayQueue(int capacity,
int growBy)
capacity - Initial capacitygrowBy - Incremental capacity.
public BlockingArrayQueue(int capacity,
int growBy,
int limit)
capacity - Initial capacitygrowBy - Incremental capacity.limit - maximum capacity.| Method Detail |
|---|
public int getCapacity()
public int getLimit()
public boolean add(E e)
add in interface java.util.Collection<E>add in interface java.util.concurrent.BlockingQueue<E>add in interface java.util.List<E>add in class java.util.AbstractList<E>public E element()
element in interface java.util.Queue<E>public E peek()
peek in interface java.util.Queue<E>public boolean offer(E e)
offer in interface java.util.concurrent.BlockingQueue<E>offer in interface java.util.Queue<E>public E poll()
poll in interface java.util.Queue<E>
public E take()
throws java.lang.InterruptedException
take in interface java.util.concurrent.BlockingQueue<E>java.lang.InterruptedException - if interrupted while waiting.
public E poll(long time,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
poll in interface java.util.concurrent.BlockingQueue<E>time - how long to wait before giving up, in units of
unitunit - a TimeUnit determining how to interpret the
timeout parameter
java.lang.InterruptedException - if interrupted while waiting.public E remove()
remove in interface java.util.Queue<E>public void clear()
clear in interface java.util.Collection<E>clear in interface java.util.List<E>clear in class java.util.AbstractList<E>public boolean isEmpty()
isEmpty in interface java.util.Collection<E>isEmpty in interface java.util.List<E>isEmpty in class java.util.AbstractCollection<E>public int size()
size in interface java.util.Collection<E>size in interface java.util.List<E>size in class java.util.AbstractCollection<E>public E get(int index)
get in interface java.util.List<E>get in class java.util.AbstractList<E>public E remove(int index)
remove in interface java.util.List<E>remove in class java.util.AbstractList<E>
public E set(int index,
E e)
set in interface java.util.List<E>set in class java.util.AbstractList<E>
public void add(int index,
E e)
add in interface java.util.List<E>add in class java.util.AbstractList<E>public int drainTo(java.util.Collection<? super E> c)
drainTo in interface java.util.concurrent.BlockingQueue<E>
public int drainTo(java.util.Collection<? super E> c,
int maxElements)
drainTo in interface java.util.concurrent.BlockingQueue<E>
public boolean offer(E o,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
offer in interface java.util.concurrent.BlockingQueue<E>java.lang.InterruptedException
public void put(E o)
throws java.lang.InterruptedException
put in interface java.util.concurrent.BlockingQueue<E>java.lang.InterruptedExceptionpublic int remainingCapacity()
remainingCapacity in interface java.util.concurrent.BlockingQueue<E>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||