org.eclipse.jetty.util.thread
类 QueuedThreadPool

java.lang.Object
  继承者 org.eclipse.jetty.util.component.AbstractLifeCycle
      继承者 org.eclipse.jetty.util.thread.QueuedThreadPool
所有已实现的接口:
Executor, Dumpable, LifeCycle, ThreadPool, ThreadPool.SizedThreadPool

public class QueuedThreadPool
extends AbstractLifeCycle
implements ThreadPool.SizedThreadPool, Executor, Dumpable


嵌套类摘要
 
从类 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
 
构造方法摘要
QueuedThreadPool()
          Construct
QueuedThreadPool(BlockingQueue<Runnable> jobQ)
          Construct
QueuedThreadPool(int maxThreads)
          Construct
 
方法摘要
 boolean dispatch(Runnable job)
           
protected  void doStart()
           
protected  void doStop()
           
 String dump()
           
 void dump(Appendable out, String indent)
           
 String dumpThread(long id)
           
 void execute(Runnable job)
           
 int getIdleThreads()
           
 int getMaxIdleTimeMs()
          Get the maximum thread idle time.
 int getMaxQueued()
           
 int getMaxStopTimeMs()
           
 int getMaxThreads()
          Set the maximum number of threads.
 int getMinThreads()
          Get the minimum number of threads.
 String getName()
           
protected  BlockingQueue<Runnable> getQueue()
           
 int getThreads()
           
 int getThreadsPriority()
          Get the priority of the pool threads.
 boolean interruptThread(long id)
           
 boolean isDaemon()
          Delegated to the named or anonymous Pool.
 boolean isDetailedDump()
           
 boolean isLowOnThreads()
           
 void join()
          Blocks until the thread pool is stopped.
protected  Thread newThread(Runnable runnable)
           
protected  void runJob(Runnable job)
          Runs the given job in the current thread.
 void setDaemon(boolean daemon)
          Delegated to the named or anonymous Pool.
 void setDetailedDump(boolean detailedDump)
           
 void setMaxIdleTimeMs(int maxIdleTimeMs)
          Set the maximum thread idle time.
 void setMaxQueued(int max)
           
 void setMaxStopTimeMs(int stopTimeMs)
           
 void setMaxThreads(int maxThreads)
          Set the maximum number of threads.
 void setMinThreads(int minThreads)
          Set the minimum number of threads.
 void setName(String name)
           
 void setThreadsPriority(int priority)
          Set the priority of the pool threads.
 boolean stopThread(long id)
          已过时。 Use interruptThread(long) in preference
 String toString()
           
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的方法
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

QueuedThreadPool

public QueuedThreadPool()
Construct


QueuedThreadPool

public QueuedThreadPool(int maxThreads)
Construct


QueuedThreadPool

public QueuedThreadPool(BlockingQueue<Runnable> jobQ)
Construct

方法详细信息

doStart

protected void doStart()
                throws Exception
覆盖:
AbstractLifeCycle 中的 doStart
抛出:
Exception

doStop

protected void doStop()
               throws Exception
覆盖:
AbstractLifeCycle 中的 doStop
抛出:
Exception

setDaemon

public void setDaemon(boolean daemon)
Delegated to the named or anonymous Pool.


setMaxIdleTimeMs

public void setMaxIdleTimeMs(int maxIdleTimeMs)
Set the maximum thread idle time. Threads that are idle for longer than this period may be stopped. Delegated to the named or anonymous Pool.

参数:
maxIdleTimeMs - Max idle time in ms.
另请参见:
getMaxIdleTimeMs()

setMaxStopTimeMs

public void setMaxStopTimeMs(int stopTimeMs)
参数:
stopTimeMs - maximum total time that stop() will wait for threads to die.

setMaxThreads

public void setMaxThreads(int maxThreads)
Set the maximum number of threads. Delegated to the named or anonymous Pool.

指定者:
接口 ThreadPool.SizedThreadPool 中的 setMaxThreads
参数:
maxThreads - maximum number of threads.
另请参见:
getMaxThreads()

setMinThreads

public void setMinThreads(int minThreads)
Set the minimum number of threads. Delegated to the named or anonymous Pool.

指定者:
接口 ThreadPool.SizedThreadPool 中的 setMinThreads
参数:
minThreads - minimum number of threads
另请参见:
getMinThreads()

setName

public void setName(String name)
参数:
name - Name of the BoundedThreadPool to use when naming Threads.

setThreadsPriority

public void setThreadsPriority(int priority)
Set the priority of the pool threads.

参数:
priority - the new thread priority.

getMaxQueued

public int getMaxQueued()
返回:
maximum queue size

setMaxQueued

public void setMaxQueued(int max)
参数:
max - job queue size

getMaxIdleTimeMs

public int getMaxIdleTimeMs()
Get the maximum thread idle time. Delegated to the named or anonymous Pool.

返回:
Max idle time in ms.
另请参见:
setMaxIdleTimeMs(int)

getMaxStopTimeMs

public int getMaxStopTimeMs()
返回:
maximum total time that stop() will wait for threads to die.

getMaxThreads

public int getMaxThreads()
Set the maximum number of threads. Delegated to the named or anonymous Pool.

指定者:
接口 ThreadPool.SizedThreadPool 中的 getMaxThreads
返回:
maximum number of threads.
另请参见:
setMaxThreads(int)

getMinThreads

public int getMinThreads()
Get the minimum number of threads. Delegated to the named or anonymous Pool.

指定者:
接口 ThreadPool.SizedThreadPool 中的 getMinThreads
返回:
minimum number of threads.
另请参见:
setMinThreads(int)

getName

public String getName()
返回:
The name of the BoundedThreadPool.

getThreadsPriority

public int getThreadsPriority()
Get the priority of the pool threads.

返回:
the priority of the pool threads.

isDaemon

public boolean isDaemon()
Delegated to the named or anonymous Pool.


isDetailedDump

public boolean isDetailedDump()

setDetailedDump

public void setDetailedDump(boolean detailedDump)

dispatch

public boolean dispatch(Runnable job)
指定者:
接口 ThreadPool 中的 dispatch

execute

public void execute(Runnable job)
指定者:
接口 Executor 中的 execute

join

public void join()
          throws InterruptedException
Blocks until the thread pool is stopped.

指定者:
接口 ThreadPool 中的 join
抛出:
InterruptedException

getThreads

public int getThreads()
指定者:
接口 ThreadPool 中的 getThreads
返回:
The total number of threads currently in the pool

getIdleThreads

public int getIdleThreads()
指定者:
接口 ThreadPool 中的 getIdleThreads
返回:
The number of idle threads in the pool

isLowOnThreads

public boolean isLowOnThreads()
指定者:
接口 ThreadPool 中的 isLowOnThreads
返回:
True if the pool is at maxThreads and there are not more idle threads than queued jobs

newThread

protected Thread newThread(Runnable runnable)

dump

public String dump()
指定者:
接口 Dumpable 中的 dump

dump

public void dump(Appendable out,
                 String indent)
          throws IOException
指定者:
接口 Dumpable 中的 dump
抛出:
IOException

toString

public String toString()
覆盖:
Object 中的 toString

runJob

protected void runJob(Runnable job)

Runs the given job in the current thread.

Subclasses may override to perform pre/post actions before/after the job is run.

参数:
job - the job to run

getQueue

protected BlockingQueue<Runnable> getQueue()
返回:
the job queue

stopThread

@Deprecated
public boolean stopThread(long id)
已过时。 Use interruptThread(long) in preference

参数:
id - The thread ID to stop.
返回:
true if the thread was found and stopped.

interruptThread

public boolean interruptThread(long id)
参数:
id - The thread ID to interrupt.
返回:
true if the thread was found and interrupted.

dumpThread

public String dumpThread(long id)
参数:
id - The thread ID to interrupt.
返回:
true if the thread was found and interrupted.


Copyright © 2013. All Rights Reserved.