public class ExecutorThreadPool extends AbstractLifeCycle implements ThreadPool, LifeCycle
ExecutorService as a ThreadPool and
LifeCycle interfaces so that it may be used by the Jetty org.eclipse.jetty.server.ServerAbstractLifeCycle.AbstractLifeCycleListenerThreadPool.SizedThreadPoolLifeCycle.Listener_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING| Constructor and Description |
|---|
ExecutorThreadPool()
Wraps an
ThreadPoolExecutor. |
ExecutorThreadPool(ExecutorService executor) |
ExecutorThreadPool(int queueSize)
Wraps an
ThreadPoolExecutor. |
ExecutorThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime)
Wraps an
ThreadPoolExecutor using
an unbounded LinkedBlockingQueue is used for the jobs queue; |
ExecutorThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit)
Wraps an
ThreadPoolExecutor using
an unbounded LinkedBlockingQueue is used for the jobs queue. |
ExecutorThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue)
Wraps an
ThreadPoolExecutor |
| Modifier and Type | Method and Description |
|---|---|
boolean |
dispatch(Runnable job) |
protected void |
doStop() |
int |
getIdleThreads() |
int |
getThreads() |
boolean |
isLowOnThreads() |
void |
join()
Blocks until the thread pool is
stopped. |
addLifeCycleListener, doStart, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stoppublic ExecutorThreadPool(ExecutorService executor)
public ExecutorThreadPool()
ThreadPoolExecutor.
Max pool size is 256, pool thread timeout after 60 seconds and
an unbounded LinkedBlockingQueue is used for the job queue;public ExecutorThreadPool(int queueSize)
ThreadPoolExecutor.
Max pool size is 256, pool thread timeout after 60 seconds, and core pool size is 32 when queueSize >= 0.queueSize - can be -1 for using an unbounded LinkedBlockingQueue, 0 for using a
SynchronousQueue, greater than 0 for using a ArrayBlockingQueue of the given size.public ExecutorThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime)
ThreadPoolExecutor using
an unbounded LinkedBlockingQueue is used for the jobs queue;corePoolSize - must be equal to maximumPoolSizemaximumPoolSize - the maximum number of threads to allow in the poolkeepAliveTime - the max time a thread can remain idle, in millisecondspublic ExecutorThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit)
ThreadPoolExecutor using
an unbounded LinkedBlockingQueue is used for the jobs queue.corePoolSize - must be equal to maximumPoolSizemaximumPoolSize - the maximum number of threads to allow in the poolkeepAliveTime - the max time a thread can remain idleunit - the unit for the keepAliveTimepublic ExecutorThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue)
ThreadPoolExecutorcorePoolSize - the number of threads to keep in the pool, even if they are idlemaximumPoolSize - the maximum number of threads to allow in the poolkeepAliveTime - the max time a thread can remain idleunit - the unit for the keepAliveTimeworkQueue - the queue to use for holding tasks before they are executedpublic boolean dispatch(Runnable job)
dispatch in interface ThreadPoolpublic int getIdleThreads()
getIdleThreads in interface ThreadPoolpublic int getThreads()
getThreads in interface ThreadPoolpublic boolean isLowOnThreads()
isLowOnThreads in interface ThreadPoolpublic void join()
throws InterruptedException
ThreadPoolstopped.join in interface ThreadPoolInterruptedExceptionprotected void doStop()
throws Exception
doStop in class AbstractLifeCycleExceptionCopyright © 1995-2015 Mort Bay Consulting. All Rights Reserved.