|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jetty.util.component.AbstractLifeCycle org.eclipse.jetty.util.thread.OldQueuedThreadPool
public class OldQueuedThreadPool
A pool of threads.
Avoids the expense of thread creation by pooling threads after their run methods exit for reuse.
If an idle thread is available a job is directly dispatched, otherwise the job is queued. After queuing a job, if the total number of threads is less than the maximum pool size, a new thread is spawned.
Nested Class Summary | |
---|---|
class |
OldQueuedThreadPool.PoolThread
Pool Thread class. |
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
LifeCycle.Listener |
Field Summary |
---|
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
Constructor Summary | |
---|---|
OldQueuedThreadPool()
|
|
OldQueuedThreadPool(int maxThreads)
|
Method Summary | |
---|---|
boolean |
dispatch(Runnable job)
Run job. |
protected void |
doStart()
|
protected void |
doStop()
Stop the BoundedThreadPool. |
int |
getIdleThreads()
Get the number of idle threads in the pool. |
int |
getLowThreads()
|
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()
|
int |
getQueueSize()
|
int |
getSpawnOrShrinkAt()
|
int |
getThreads()
Get the number of threads in the pool. |
int |
getThreadsPriority()
Get the priority of the pool threads. |
boolean |
isDaemon()
Delegated to the named or anonymous Pool. |
boolean |
isLowOnThreads()
|
void |
join()
Blocks until the thread pool is stopped . |
protected void |
newThread()
|
void |
setDaemon(boolean daemon)
Delegated to the named or anonymous Pool. |
void |
setLowThreads(int lowThreads)
|
void |
setMaxIdleTimeMs(int maxIdleTimeMs)
Set the maximum thread idle time. |
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 |
setSpawnOrShrinkAt(int spawnOrShrinkAt)
|
void |
setThreadsPriority(int priority)
Set the priority of the pool threads. |
protected void |
stopJob(Thread thread,
Object job)
Stop a Job. |
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
addLifeCycleListener, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OldQueuedThreadPool()
public OldQueuedThreadPool(int maxThreads)
Method Detail |
---|
public boolean dispatch(Runnable job)
dispatch
in interface ThreadPool
public int getIdleThreads()
getIdleThreads
in interface ThreadPool
getThreads()
public int getLowThreads()
public int getMaxQueued()
public int getMaxIdleTimeMs()
setMaxIdleTimeMs(int)
public int getMaxThreads()
setMaxThreads(int)
public int getMinThreads()
setMinThreads(int)
public String getName()
public int getThreads()
getThreads
in interface ThreadPool
getIdleThreads()
public int getThreadsPriority()
public int getQueueSize()
public int getSpawnOrShrinkAt()
public void setSpawnOrShrinkAt(int spawnOrShrinkAt)
spawnOrShrinkAt
- The number of queued jobs (or idle threads) needed
before the thread pool is grown (or shrunk)public int getMaxStopTimeMs()
public void setMaxStopTimeMs(int stopTimeMs)
stopTimeMs
- maximum total time that stop() will wait for threads to die.public boolean isDaemon()
public boolean isLowOnThreads()
isLowOnThreads
in interface ThreadPool
public void join() throws InterruptedException
ThreadPool
stopped
.
join
in interface ThreadPool
InterruptedException
public void setDaemon(boolean daemon)
public void setLowThreads(int lowThreads)
lowThreads
- low resource threads threshholdpublic void setMaxIdleTimeMs(int maxIdleTimeMs)
maxIdleTimeMs
- Max idle time in ms.getMaxIdleTimeMs()
public void setMaxThreads(int maxThreads)
maxThreads
- maximum number of threads.getMaxThreads()
public void setMinThreads(int minThreads)
minThreads
- minimum number of threadsgetMinThreads()
public void setName(String name)
name
- Name of the BoundedThreadPool to use when naming Threads.public void setThreadsPriority(int priority)
priority
- the new thread priority.protected void doStart() throws Exception
doStart
in class AbstractLifeCycle
Exception
protected void doStop() throws Exception
doStop
in class AbstractLifeCycle
Exception
protected void newThread()
protected void stopJob(Thread thread, Object job)
thread
- The thread allocated to the job, or null if no thread allocated.job
- The job object passed to run.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |