org.eclipse.jetty.util
类 BlockingArrayQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
org.eclipse.jetty.util.BlockingArrayQueue<E>
- 类型参数:
E - The element type
- 所有已实现的接口:
- Iterable<E>, Collection<E>, BlockingQueue<E>, List<E>, Queue<E>
public class BlockingArrayQueue<E>
- extends AbstractList<E>
- implements BlockingQueue<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.
DEFAULT_CAPACITY
public final int DEFAULT_CAPACITY
- 另请参见:
- 常量字段值
DEFAULT_GROWTH
public final int DEFAULT_GROWTH
- 另请参见:
- 常量字段值
BlockingArrayQueue
public BlockingArrayQueue()
- Create a growing partially blocking Queue
BlockingArrayQueue
public BlockingArrayQueue(int limit)
- Create a fixed size partially blocking Queue
- 参数:
limit - The initial capacity and the limit.
BlockingArrayQueue
public BlockingArrayQueue(int capacity,
int growBy)
- Create a growing partially blocking Queue.
- 参数:
capacity - Initial capacitygrowBy - Incremental capacity.
BlockingArrayQueue
public BlockingArrayQueue(int capacity,
int growBy,
int limit)
- Create a growing limited partially blocking Queue.
- 参数:
capacity - Initial capacitygrowBy - Incremental capacity.limit - maximum capacity.
getCapacity
public int getCapacity()
getLimit
public int getLimit()
add
public boolean add(E e)
- 指定者:
- 接口
Collection<E> 中的 add - 指定者:
- 接口
BlockingQueue<E> 中的 add - 指定者:
- 接口
List<E> 中的 add - 指定者:
- 接口
Queue<E> 中的 add - 覆盖:
- 类
AbstractList<E> 中的 add
element
public E element()
- 指定者:
- 接口
Queue<E> 中的 element
peek
public E peek()
- 指定者:
- 接口
Queue<E> 中的 peek
offer
public boolean offer(E e)
- 指定者:
- 接口
BlockingQueue<E> 中的 offer - 指定者:
- 接口
Queue<E> 中的 offer
poll
public E poll()
- 指定者:
- 接口
Queue<E> 中的 poll
take
public E take()
throws InterruptedException
- Retrieves and removes the head of this queue, waiting
if no elements are present on this queue.
- 指定者:
- 接口
BlockingQueue<E> 中的 take
- 返回:
- the head of this queue
- 抛出:
InterruptedException - if interrupted while waiting.
poll
public E poll(long time,
TimeUnit unit)
throws InterruptedException
- 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.
- 指定者:
- 接口
BlockingQueue<E> 中的 poll
- 参数:
time - how long to wait before giving up, in units of
unitunit - a TimeUnit determining how to interpret the
timeout parameter
- 返回:
- the head of this queue, or null if the
specified waiting time elapses before an element is present.
- 抛出:
InterruptedException - if interrupted while waiting.
remove
public E remove()
- 指定者:
- 接口
Queue<E> 中的 remove
clear
public void clear()
- 指定者:
- 接口
Collection<E> 中的 clear - 指定者:
- 接口
List<E> 中的 clear - 覆盖:
- 类
AbstractList<E> 中的 clear
isEmpty
public boolean isEmpty()
- 指定者:
- 接口
Collection<E> 中的 isEmpty - 指定者:
- 接口
List<E> 中的 isEmpty - 覆盖:
- 类
AbstractCollection<E> 中的 isEmpty
size
public int size()
- 指定者:
- 接口
Collection<E> 中的 size - 指定者:
- 接口
List<E> 中的 size - 指定者:
- 类
AbstractCollection<E> 中的 size
get
public E get(int index)
- 指定者:
- 接口
List<E> 中的 get - 指定者:
- 类
AbstractList<E> 中的 get
remove
public E remove(int index)
- 指定者:
- 接口
List<E> 中的 remove - 覆盖:
- 类
AbstractList<E> 中的 remove
set
public E set(int index,
E e)
- 指定者:
- 接口
List<E> 中的 set - 覆盖:
- 类
AbstractList<E> 中的 set
add
public void add(int index,
E e)
- 指定者:
- 接口
List<E> 中的 add - 覆盖:
- 类
AbstractList<E> 中的 add
drainTo
public int drainTo(Collection<? super E> c)
- 指定者:
- 接口
BlockingQueue<E> 中的 drainTo
drainTo
public int drainTo(Collection<? super E> c,
int maxElements)
- 指定者:
- 接口
BlockingQueue<E> 中的 drainTo
offer
public boolean offer(E o,
long timeout,
TimeUnit unit)
throws InterruptedException
- 指定者:
- 接口
BlockingQueue<E> 中的 offer
- 抛出:
InterruptedException
put
public void put(E o)
throws InterruptedException
- 指定者:
- 接口
BlockingQueue<E> 中的 put
- 抛出:
InterruptedException
remainingCapacity
public int remainingCapacity()
- 指定者:
- 接口
BlockingQueue<E> 中的 remainingCapacity
Copyright © 2013. All Rights Reserved.