org.eclipse.jetty.util.thread
类 ExecutorThreadPool
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.thread.ExecutorThreadPool
- 所有已实现的接口:
- LifeCycle, ThreadPool
public class ExecutorThreadPool
- extends AbstractLifeCycle
- implements ThreadPool, LifeCycle
Jetty ThreadPool using java 5 ThreadPoolExecutor
This class wraps a ExecutorService as a ThreadPool and
LifeCycle interfaces so that it may be used by the Jetty org.eclipse.jetty.server.Server
| 从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的方法 |
addLifeCycleListener, doStart, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
| 从类 java.lang.Object 继承的方法 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExecutorThreadPool
public ExecutorThreadPool(ExecutorService executor)
ExecutorThreadPool
public ExecutorThreadPool()
- Wraps an
ThreadPoolExecutor.
Max pool size is 256, pool thread timeout after 60 seconds and
an unbounded LinkedBlockingQueue is used for the job queue;
ExecutorThreadPool
public ExecutorThreadPool(int queueSize)
- Wraps an
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.
ExecutorThreadPool
public ExecutorThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime)
- Wraps an
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 milliseconds
ExecutorThreadPool
public ExecutorThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit)
- Wraps an
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 keepAliveTime
ExecutorThreadPool
public ExecutorThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue)
- Wraps an
ThreadPoolExecutor
- 参数:
corePoolSize - 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 executed
dispatch
public boolean dispatch(Runnable job)
- 指定者:
- 接口
ThreadPool 中的 dispatch
getIdleThreads
public int getIdleThreads()
- 指定者:
- 接口
ThreadPool 中的 getIdleThreads
- 返回:
- The number of idle threads in the pool
getThreads
public int getThreads()
- 指定者:
- 接口
ThreadPool 中的 getThreads
- 返回:
- The total number of threads currently in the pool
isLowOnThreads
public boolean isLowOnThreads()
- 指定者:
- 接口
ThreadPool 中的 isLowOnThreads
- 返回:
- True if the pool is low on threads
join
public void join()
throws InterruptedException
- 从接口
ThreadPool 复制的描述
- Blocks until the thread pool is
stopped.
- 指定者:
- 接口
ThreadPool 中的 join
- 抛出:
InterruptedException
doStop
protected void doStop()
throws Exception
- 覆盖:
- 类
AbstractLifeCycle 中的 doStop
- 抛出:
Exception
Copyright © 2013. All Rights Reserved.