org.apache.tomcat.util.threads
Class TaskQueue
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
java.util.concurrent.LinkedBlockingQueue<Runnable>
org.apache.tomcat.util.threads.TaskQueue
- All Implemented Interfaces:
- Serializable, Iterable<Runnable>, Collection<Runnable>, BlockingQueue<Runnable>, Queue<Runnable>
public class TaskQueue
- extends LinkedBlockingQueue<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 unto the queue itself
- Author:
- fhanik
- See Also:
- Serialized Form
Methods inherited from class java.util.concurrent.LinkedBlockingQueue |
clear, drainTo, drainTo, iterator, offer, peek, poll, put, remove, size, toArray, toArray, toString |
TaskQueue
public TaskQueue()
TaskQueue
public TaskQueue(int capacity)
TaskQueue
public TaskQueue(Collection<? extends Runnable> c)
setParent
public void setParent(ThreadPoolExecutor tp)
force
public boolean force(Runnable o)
force
public boolean force(Runnable o,
long timeout,
TimeUnit unit)
throws InterruptedException
- Throws:
InterruptedException
offer
public boolean offer(Runnable o)
- Specified by:
offer
in interface BlockingQueue<Runnable>
- Specified by:
offer
in interface Queue<Runnable>
- Overrides:
offer
in class LinkedBlockingQueue<Runnable>
poll
public Runnable poll(long timeout,
TimeUnit unit)
throws InterruptedException
- Specified by:
poll
in interface BlockingQueue<Runnable>
- Overrides:
poll
in class LinkedBlockingQueue<Runnable>
- Throws:
InterruptedException
take
public Runnable take()
throws InterruptedException
- Specified by:
take
in interface BlockingQueue<Runnable>
- Overrides:
take
in class LinkedBlockingQueue<Runnable>
- Throws:
InterruptedException
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacity
in interface BlockingQueue<Runnable>
- Overrides:
remainingCapacity
in class LinkedBlockingQueue<Runnable>
setForcedRemainingCapacity
public void setForcedRemainingCapacity(Integer forcedRemainingCapacity)
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.