Class TaskQueue
- All Implemented Interfaces:
- Serializable,- Iterable<Runnable>,- Collection<Runnable>,- BlockingQueue<Runnable>,- Queue<Runnable>,- RetryableQueue<Runnable>
As task queue specifically designed to run with a thread pool executor. The
 task queue is optimised to properly utilize threads within a thread pool
 executor. If you use a normal queue, the executor will spawn threads when
 there are idle threads and you won't be able to force items onto the queue
 itself.
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanUsed to add a task to the queue if the task has been rejected by the Executor.booleanDeprecated.booleanvoidtake()Methods inherited from class java.util.concurrent.LinkedBlockingQueueclear, contains, drainTo, drainTo, forEach, iterator, offer, peek, poll, put, remainingCapacity, remove, removeAll, removeIf, retainAll, size, spliterator, toArray, toArray, toStringMethods inherited from class java.util.AbstractQueueadd, addAll, element, removeMethods inherited from class java.util.AbstractCollectioncontainsAll, isEmptyMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.BlockingQueueadd, contains, drainTo, drainTo, offer, put, remainingCapacity, removeMethods inherited from interface java.util.CollectionaddAll, clear, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
- 
Field Details- 
sm
 
- 
- 
Constructor Details- 
TaskQueuepublic TaskQueue()
- 
TaskQueuepublic TaskQueue(int capacity) 
- 
TaskQueue
 
- 
- 
Method Details- 
setParent
- 
forceDescription copied from interface:RetryableQueueUsed to add a task to the queue if the task has been rejected by the Executor.- Specified by:
- forcein interface- RetryableQueue<Runnable>
- Parameters:
- o- The task to add to the queue
- Returns:
- trueif the task was added to the queue, otherwise- false
 
- 
force@Deprecated public boolean force(Runnable o, long timeout, TimeUnit unit) throws InterruptedException Deprecated.Description copied from interface:RetryableQueueUsed to add a task to the queue if the task has been rejected by the Executor.- Specified by:
- forcein interface- RetryableQueue<Runnable>
- Parameters:
- o- The task to add to the queue
- timeout- The timeout to use when adding the task
- unit- The units in which the timeout is expressed
- Returns:
- trueif the task was added to the queue, otherwise- false
- Throws:
- InterruptedException- If the call is interrupted before the timeout expires
 
- 
offer- Specified by:
- offerin interface- BlockingQueue<Runnable>
- Specified by:
- offerin interface- Queue<Runnable>
- Overrides:
- offerin class- LinkedBlockingQueue<Runnable>
 
- 
poll- Specified by:
- pollin interface- BlockingQueue<Runnable>
- Overrides:
- pollin class- LinkedBlockingQueue<Runnable>
- Throws:
- InterruptedException
 
- 
take- Specified by:
- takein interface- BlockingQueue<Runnable>
- Overrides:
- takein class- LinkedBlockingQueue<Runnable>
- Throws:
- InterruptedException
 
 
-