public class ThreadPool extends ThreadPoolExecutor implements org.mortbay.thread.ThreadPool, org.mortbay.component.LifeCycle
ThreadPoolExecutor with the ThreadPool and
LifeCycle interfaces so that it may be used by the Jetty org.mortbay.jetty.ServerThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy| Constructor and Description |
|---|
ThreadPool()
Default constructor.
|
ThreadPool(int queueSize)
Default constructor.
|
ThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit)
Size constructor.
|
ThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue) |
ThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
RejectedExecutionHandler handler) |
ThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory) |
ThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory,
RejectedExecutionHandler handler) |
| Modifier and Type | Method and Description |
|---|---|
void |
addLifeCycleListener(org.mortbay.component.LifeCycle.Listener listener) |
boolean |
dispatch(Runnable job) |
int |
getIdleThreads() |
int |
getThreads() |
boolean |
isFailed() |
boolean |
isLowOnThreads() |
boolean |
isRunning() |
boolean |
isStarted() |
boolean |
isStarting() |
boolean |
isStopped() |
boolean |
isStopping() |
void |
join() |
void |
removeLifeCycleListener(org.mortbay.component.LifeCycle.Listener listener) |
void |
start() |
void |
stop() |
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toStringinvokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitpublic ThreadPool()
LinkedBlockingQueue is used for the job queue;public ThreadPool(int queueSize)
queueSize - if -1, an unbounded LinkedBlockingQueue is used, if 0 then a
SynchronousQueue is used, other a ArrayBlockingQueue of the given size is used.public ThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit)
LinkedBlockingQueue is used for the jobs queue;public ThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue)
public ThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
RejectedExecutionHandler handler)
public ThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory,
RejectedExecutionHandler handler)
public ThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory)
public boolean dispatch(Runnable job)
dispatch in interface org.mortbay.thread.ThreadPoolpublic int getIdleThreads()
getIdleThreads in interface org.mortbay.thread.ThreadPoolpublic int getThreads()
getThreads in interface org.mortbay.thread.ThreadPoolpublic boolean isLowOnThreads()
isLowOnThreads in interface org.mortbay.thread.ThreadPoolpublic void join()
throws InterruptedException
join in interface org.mortbay.thread.ThreadPoolInterruptedExceptionpublic boolean isFailed()
isFailed in interface org.mortbay.component.LifeCyclepublic boolean isRunning()
isRunning in interface org.mortbay.component.LifeCyclepublic boolean isStarted()
isStarted in interface org.mortbay.component.LifeCyclepublic boolean isStarting()
isStarting in interface org.mortbay.component.LifeCyclepublic boolean isStopped()
isStopped in interface org.mortbay.component.LifeCyclepublic boolean isStopping()
isStopping in interface org.mortbay.component.LifeCyclepublic void start()
throws Exception
start in interface org.mortbay.component.LifeCycleExceptionpublic void stop()
throws Exception
stop in interface org.mortbay.component.LifeCycleExceptionpublic void addLifeCycleListener(org.mortbay.component.LifeCycle.Listener listener)
addLifeCycleListener in interface org.mortbay.component.LifeCyclepublic void removeLifeCycleListener(org.mortbay.component.LifeCycle.Listener listener)
removeLifeCycleListener in interface org.mortbay.component.LifeCycleCopyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.