Creates a {@code LinkedBlockingDeque} with a capacity of {@link Integer#MAX_VALUE}.
Creates a {@code LinkedBlockingDeque} with a capacity of {@link Integer#MAX_VALUE} and the given fairness policy. @param fairness true means threads waiting on the deque should be served as if waiting in a FIFO request queue
Creates a {@code LinkedBlockingDeque} with the given (fixed) capacity.
Creates a {@code LinkedBlockingDeque} with the given (fixed) capacity and fairness policy.
Creates a {@code LinkedBlockingDeque} with a capacity of {@link Integer#MAX_VALUE}, initially containing the elements of the given collection, added in traversal order of the collection's iterator.
Atomically removes all of the elements from this deque. The deque will be empty after this call returns.
Returns {@code true} if this deque contains the specified element. More formally, returns {@code true} if and only if this deque contains at least one element {@code e} such that {@code o == e}.
{@inheritDoc}
Drains the queue to the specified collection.
Drains no more than the specified number of elements from the queue to the specified collection.
{@inheritDoc}
{@inheritDoc}
Returns the length of the queue of threads waiting to take instances from this deque. See disclaimer on accuracy in {@link java.util.concurrent.locks.ReentrantLock#getWaitQueueLength(Condition)}.
Returns true if there are threads waiting to take instances from this deque. See disclaimer on accuracy in {@link java.util.concurrent.locks.ReentrantLock#hasWaiters(Condition)}.
Interrupts the threads currently waiting to take an object from the pool. See disclaimer on accuracy in {@link java.util.concurrent.locks.ReentrantLock#getWaitingThreads(Condition)}.
Returns an iterator over the elements in this deque in proper sequence. The elements will be returned in order from first (head) to last (tail). The returned {@code Iterator} is a "weakly consistent" iterator that will never throw {@link java.util.ConcurrentModificationException ConcurrentModificationException}, and guarantees to traverse elements as they existed upon construction of the iterator, and may (but is not guaranteed to) reflect any modifications subsequent to construction.
{@inheritDoc}
Links the provided element as the first in the queue, waiting up to the specified time to do so if the queue is full.
{@inheritDoc}
Links the provided element as the last in the queue, waiting up to the specified time to do so if the queue is full.
Unlinks the first element in the queue, waiting up to the specified time to do so if the queue is empty.
Unlinks the last element in the queue, waiting up to the specified time to do so if the queue is empty.
Links the provided element as the first in the queue, waiting until there is space to do so if the queue is full.
Links the provided element as the last in the queue, waiting until there is space to do so if the queue is full.
Returns the number of additional elements that this deque can ideally (in the absence of memory or resource constraints) accept without blocking. This is always equal to the initial capacity of this deque less the current {@code size} of this deque.
Returns the number of elements in this deque.
Unlinks the first element in the queue, waiting until there is an element to unlink if the queue is empty.
Unlinks the last element in the queue, waiting until there is an element to unlink if the queue is empty.
Returns an array containing all of the elements in this deque, in proper sequence (from first to last element).
{@inheritDoc}
An optionally-bounded {@linkplain java.util.concurrent.BlockingDeque blocking deque} based on linked nodes.
<p> The optional capacity bound constructor argument serves as a way to prevent excessive expansion. The capacity, if unspecified, is equal to {@link Integer#MAX_VALUE}. Linked nodes are dynamically created upon each insertion unless this would bring the deque above capacity.
<p>Most operations run in constant time (ignoring time spent blocking). Exceptions include {@link #remove(Object) remove}, {@link #removeFirstOccurrence removeFirstOccurrence}, {@link #removeLastOccurrence removeLastOccurrence}, {@link #contains contains}, {@link #iterator iterator.remove()}, and the bulk operations, all of which run in linear time.
<p>This class and its iterator implement all of the <em>optional</em> methods of the {@link Collection} and {@link Iterator} interfaces.
<p>This class is a member of the <a href="{@docRoot}/../technotes/guides/collections/index.html"> Java Collections Framework</a>.
@param <E> the type of elements held in this collection
Note: This was copied from Apache Harmony and modified to suit the needs of Commons Pool.