|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.botbox.util.ThreadPool
public final class ThreadPool
This class implements a thread pool for reusing threads. Since only a maximal number of threads may exist in the pool it is important that the threads in the pool is not absorbed by long duration tasks that drains the pool.
Constructor Summary | |
---|---|
ThreadPool(java.lang.String name)
|
Method Summary | |
---|---|
static ThreadPool |
getDefaultThreadPool()
|
int |
getIdleThreads()
Returns the current number of idle threads |
static JobStatus |
getJobStatus()
|
int |
getMaxIdleThreads()
|
int |
getMaxThreads()
|
int |
getMinThreads()
|
java.lang.String |
getName()
|
int |
getQueueSize()
|
long |
getQueueTime()
|
static ThreadPool |
getThreadPool(java.lang.String name)
|
static java.util.Enumeration |
getThreadPools()
|
int |
getThreads()
|
java.lang.String |
getThreadStatus()
Returns the status of all existing pool threads or null if
no pool threads exists. |
java.lang.StringBuffer |
getThreadStatus(java.lang.StringBuffer sb)
|
void |
invokeLater(java.lang.Runnable job)
Invokes the specified job as soon as possible. |
void |
invokeLater(java.lang.Runnable job,
java.lang.String description)
|
boolean |
isDaemon()
|
void |
setDaemon(boolean isDaemon)
|
void |
setInterruptThreadsAfter(int milliSeconds)
Sets the time after which a running job may be interrupted if it still has not finished. |
void |
setMaxIdleThreads(int maxIdleThreads)
|
void |
setMaxThreads(int maxThreads)
|
void |
setMinThreads(int minThreads)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThreadPool(java.lang.String name)
Method Detail |
---|
public static java.util.Enumeration getThreadPools()
public static ThreadPool getThreadPool(java.lang.String name)
public static ThreadPool getDefaultThreadPool()
public static JobStatus getJobStatus()
public java.lang.String getName()
public int getThreads()
public int getIdleThreads()
public java.lang.String getThreadStatus()
null
if
no pool threads exists.
public java.lang.StringBuffer getThreadStatus(java.lang.StringBuffer sb)
public boolean isDaemon()
public void setDaemon(boolean isDaemon)
public int getMinThreads()
public void setMinThreads(int minThreads)
public int getMaxThreads()
public void setMaxThreads(int maxThreads)
public int getMaxIdleThreads()
public void setMaxIdleThreads(int maxIdleThreads)
public void setInterruptThreadsAfter(int milliSeconds)
milliSeconds
- the time after which a running job may be interrupted if it
still has not finished.public int getQueueSize()
public long getQueueTime()
public void invokeLater(java.lang.Runnable job)
job
- the job to invokepublic void invokeLater(java.lang.Runnable job, java.lang.String description)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |