|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.concurrent.AbstractExecutorService java.util.concurrent.ThreadPoolExecutor org.mortbay.thread.concurrent.ThreadPool
public class ThreadPool
Jetty ThreadPool using java 5 ThreadPoolExecutor
This class wraps a ThreadPoolExecutor
with the ThreadPool
and
LifeCycle
interfaces so that it may be used by the Jetty Server
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor |
---|
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy |
Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle |
---|
LifeCycle.Listener |
Constructor Summary | |
---|---|
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)
|
Method Summary | |
---|---|
void |
addLifeCycleListener(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()
Blocks until the thread pool is stopped . |
void |
removeLifeCycleListener(LifeCycle.Listener listener)
|
void |
start()
Starts the component. |
void |
stop()
Stops the component. |
Methods inherited from class java.util.concurrent.AbstractExecutorService |
---|
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public 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)
Method Detail |
---|
public boolean dispatch(Runnable job)
dispatch
in interface ThreadPool
public int getIdleThreads()
getIdleThreads
in interface ThreadPool
public int getThreads()
getThreads
in interface ThreadPool
public boolean isLowOnThreads()
isLowOnThreads
in interface ThreadPool
public void join() throws InterruptedException
ThreadPool
stopped
.
join
in interface ThreadPool
InterruptedException
public boolean isFailed()
isFailed
in interface LifeCycle
public boolean isRunning()
isRunning
in interface LifeCycle
public boolean isStarted()
isStarted
in interface LifeCycle
LifeCycle.start()
,
LifeCycle.isStarting()
public boolean isStarting()
isStarting
in interface LifeCycle
LifeCycle.isStarted()
public boolean isStopped()
isStopped
in interface LifeCycle
LifeCycle.stop()
,
LifeCycle.isStopping()
public boolean isStopping()
isStopping
in interface LifeCycle
LifeCycle.isStopped()
public void start() throws Exception
LifeCycle
start
in interface LifeCycle
Exception
- If the component fails to startLifeCycle.isStarted()
,
LifeCycle.stop()
,
LifeCycle.isFailed()
public void stop() throws Exception
LifeCycle
stop
in interface LifeCycle
Exception
- If the component fails to stopLifeCycle.isStopped()
,
LifeCycle.start()
,
LifeCycle.isFailed()
public void addLifeCycleListener(LifeCycle.Listener listener)
addLifeCycleListener
in interface LifeCycle
public void removeLifeCycleListener(LifeCycle.Listener listener)
removeLifeCycleListener
in interface LifeCycle
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |