public class DynamicQueue<E> extends LinkedBlockingQueue<E>
SynchronousQueuewhich acts as a rendezvous channel. It is well suited for handoff designs, in which a tasks is only queued if there is an available thread to pick it up.
This queue is correlated with a thread-pool, and allows insertions to the queue only if there
is a free thread that can poll this task. Otherwise, the task is rejected and the decision is
left up to one of the
|Constructor and Description|
Creates a DynamicQueue with a capacity of
Creates a DynamicQueue with the given (fixed) capacity.
|Modifier and Type||Method and Description|
Inserts the specified element at the tail of this queue if there is at least one available thread to run the current task.
Sets the executor this queue belongs to.
clear, contains, drainTo, drainTo, iterator, offer, peek, poll, poll, put, remainingCapacity, remove, size, spliterator, take, toArray, toArray, toString
containsAll, isEmpty, removeAll, retainAll
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAll, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, stream
public DynamicQueue(int capacity)
capacity- the capacity of this queue.
public void setThreadPoolExecutor(ThreadPoolExecutor executor)
public boolean offer(E o)
o- the element to add.
Copyright © GigaSpaces.