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 继承的嵌套类/接口
AbstractLifeCycle.AbstractLifeCycleListener
 
从接口 org.eclipse.jetty.util.thread.ThreadPool 继承的嵌套类/接口
ThreadPool.SizedThreadPool
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的嵌套类/接口
LifeCycle.Listener
 
字段摘要
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的字段
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
构造方法摘要
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
 
方法摘要
 boolean dispatch(Runnable job)
           
protected  void doStop()
           
 int getIdleThreads()
           
 int getThreads()
           
 boolean isLowOnThreads()
           
 void join()
          Blocks until the thread pool is stopped.
 
从类 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
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的方法
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 

构造方法详细信息

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 maximumPoolSize
maximumPoolSize - the maximum number of threads to allow in the pool
keepAliveTime - 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 maximumPoolSize
maximumPoolSize - the maximum number of threads to allow in the pool
keepAliveTime - the max time a thread can remain idle
unit - 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 idle
maximumPoolSize - the maximum number of threads to allow in the pool
keepAliveTime - the max time a thread can remain idle
unit - the unit for the keepAliveTime
workQueue - 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.