|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractQueue<E>
net.sf.beanlib.util.concurrent.UnboundedLinkedBlockingQueue<E>
public class UnboundedLinkedBlockingQueue<E>
| Field Summary | |
|---|---|
private Condition |
notEmpty
Wait queue for waiting takes |
private ConcurrentLinkedQueue<E> |
q
|
private static long |
serialVersionUID
|
private ReentrantLock |
takeLock
Lock held by take, poll, etc |
| Constructor Summary | |
|---|---|
UnboundedLinkedBlockingQueue()
Creates a LinkedBlockingQueue with a capacity of Integer.MAX_VALUE. |
|
UnboundedLinkedBlockingQueue(Collection<? extends E> c)
Creates a LinkedBlockingQueue with a capacity of Integer.MAX_VALUE, initially containing the elements of the
given collection,
added in traversal order of the collection's iterator. |
|
| Method Summary | |
|---|---|
int |
drainTo(Collection<? super E> c)
|
int |
drainTo(Collection<? super E> c,
int maxElements)
|
Iterator<E> |
iterator()
|
boolean |
offer(E e)
Inserts the specified element at the tail of this queue if it is possible to do so immediately without exceeding the queue's capacity, returning true upon success and false if this queue is full. |
boolean |
offer(E e,
long timeout,
TimeUnit unit)
Inserts the specified element at the tail of this queue, waiting if necessary up to the specified wait time for space to become available. |
E |
peek()
|
E |
poll()
|
E |
poll(long timeout,
TimeUnit unit)
|
void |
put(E e)
Inserts the specified element at the tail of this queue, waiting if necessary for space to become available. |
int |
remainingCapacity()
|
private void |
signalNotEmpty()
Signals a waiting take. |
int |
size()
|
E |
take()
|
| Methods inherited from class java.util.AbstractQueue |
|---|
add, addAll, clear, element, remove |
| Methods inherited from class java.util.AbstractCollection |
|---|
contains, containsAll, isEmpty, remove, 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.concurrent.BlockingQueue |
|---|
add |
| Methods inherited from interface java.util.Queue |
|---|
element, remove |
| Methods inherited from interface java.util.Collection |
|---|
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Field Detail |
|---|
private static final long serialVersionUID
private final ConcurrentLinkedQueue<E> q
private final ReentrantLock takeLock
private final Condition notEmpty
| Constructor Detail |
|---|
public UnboundedLinkedBlockingQueue()
Integer.MAX_VALUE.
public UnboundedLinkedBlockingQueue(Collection<? extends E> c)
Integer.MAX_VALUE, initially containing the elements of the
given collection,
added in traversal order of the collection's iterator.
c - the collection of elements to initially contain
NullPointerException - if the specified collection or any
of its elements are null| Method Detail |
|---|
private void signalNotEmpty()
public void put(E e)
throws InterruptedException
put in interface BlockingQueue<E>InterruptedException
NullPointerException
public boolean offer(E e,
long timeout,
TimeUnit unit)
throws InterruptedException
offer in interface BlockingQueue<E>InterruptedException
NullPointerExceptionpublic boolean offer(E e)
add, which can fail to
insert an element only by throwing an exception.
offer in interface BlockingQueue<E>offer in interface Queue<E>NullPointerException - if the specified element is null
public E take()
throws InterruptedException
take in interface BlockingQueue<E>InterruptedException
public E poll(long timeout,
TimeUnit unit)
throws InterruptedException
poll in interface BlockingQueue<E>InterruptedExceptionpublic E poll()
poll in interface Queue<E>public int drainTo(Collection<? super E> c)
drainTo in interface BlockingQueue<E>
public int drainTo(Collection<? super E> c,
int maxElements)
drainTo in interface BlockingQueue<E>public Iterator<E> iterator()
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in class AbstractCollection<E>public int size()
size in interface Collection<E>size in class AbstractCollection<E>public int remainingCapacity()
remainingCapacity in interface BlockingQueue<E>public E peek()
peek in interface Queue<E>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||