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.


字段摘要
 int DEFAULT_CAPACITY
           
 int DEFAULT_GROWTH
           
 
从类 java.util.AbstractList 继承的字段
modCount
 
构造方法摘要
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.
 
方法摘要
 boolean add(E e)
           
 void add(int index, E e)
           
 void clear()
           
 int drainTo(Collection<? super E> c)
           
 int drainTo(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, TimeUnit unit)
           
 E peek()
           
 E poll()
           
 E poll(long time, 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.
 
从类 java.util.AbstractList 继承的方法
addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
 
从类 java.util.AbstractCollection 继承的方法
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
 
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
从接口 java.util.concurrent.BlockingQueue 继承的方法
contains, remove
 
从接口 java.util.Collection 继承的方法
addAll, containsAll, equals, hashCode, iterator, removeAll, retainAll, toArray, toArray
 
从接口 java.util.List 继承的方法
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray
 

字段详细信息

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 capacity
growBy - Incremental capacity.

BlockingArrayQueue

public BlockingArrayQueue(int capacity,
                          int growBy,
                          int limit)
Create a growing limited partially blocking Queue.

参数:
capacity - Initial capacity
growBy - 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 unit
unit - 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.