Package org.apache.tomcat.util.threads
Class TaskQueue
- All Implemented Interfaces:
Serializable,Iterable<Runnable>,Collection<Runnable>,BlockingQueue<Runnable>,Queue<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 wont be able to force items onto the queue
itself.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbooleanintvoidsetForcedRemainingCapacity(int forcedRemainingCapacity) voidtake()Methods inherited from class java.util.concurrent.LinkedBlockingQueue
clear, contains, drainTo, drainTo, forEach, iterator, offer, peek, poll, put, remove, removeAll, removeIf, retainAll, size, spliterator, toArray, toArray, toStringMethods inherited from class java.util.AbstractQueue
add, addAll, element, removeMethods inherited from class java.util.AbstractCollection
containsAll, isEmptyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.BlockingQueue
addMethods inherited from interface java.util.Collection
addAll, containsAll, equals, hashCode, isEmpty, parallelStream, stream, toArray
-
Field Details
-
sm
-
-
Constructor Details
-
TaskQueue
public TaskQueue() -
TaskQueue
public TaskQueue(int capacity) -
TaskQueue
-
-
Method Details
-
setParent
-
force
-
force
- Throws:
InterruptedException
-
offer
- Specified by:
offerin interfaceBlockingQueue<Runnable>- Specified by:
offerin interfaceQueue<Runnable>- Overrides:
offerin classLinkedBlockingQueue<Runnable>
-
poll
- Specified by:
pollin interfaceBlockingQueue<Runnable>- Overrides:
pollin classLinkedBlockingQueue<Runnable>- Throws:
InterruptedException
-
take
- Specified by:
takein interfaceBlockingQueue<Runnable>- Overrides:
takein classLinkedBlockingQueue<Runnable>- Throws:
InterruptedException
-
remainingCapacity
public int remainingCapacity()- Specified by:
remainingCapacityin interfaceBlockingQueue<Runnable>- Overrides:
remainingCapacityin classLinkedBlockingQueue<Runnable>
-
setForcedRemainingCapacity
public void setForcedRemainingCapacity(int forcedRemainingCapacity)
-