|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jcs.utils.threads.ThreadPoolManager
Provides a singleton thread pool.
Field Summary | |
private ThreadPool |
pool
The thread pool. |
private static ThreadPoolManager |
singleton
The singleton thread pool manager. |
private boolean |
started
True iff the thread pool has been started. |
Constructor Summary | |
private |
ThreadPoolManager()
Can only be constructed by this class. |
Method Summary | |
static ThreadPoolManager |
getInstance()
Returns the singleton thread pool manager, which can be used to execute a given IThreadPoolRunnable on a thread in the pool. |
static int |
getMaxSpareThreads()
Gets the max number of idle threads that you can leave in the pool. |
static int |
getMaxThreads()
Gets the max number of threads that you can open in the pool. |
static int |
getMinSpareThreads()
Gets the min number of idle threads that you can leave in the pool. |
static void |
reset()
Shuts down the thread pool and re-initializes it to the default. |
void |
runIt(IThreadPoolRunnable r)
Executes a given IThreadPoolRunnable on a thread in the pool, block if needed. |
static void |
setMaxSpareThreads(int maxSpareThreads)
Sets the max number of idle threads that you can leave in the pool. |
static void |
setMaxThreads(int maxThreads)
Sets the max number of threads that you can open in the pool. |
static void |
setMinSpareThreads(int minSpareThreads)
Sets the min number of idle threads that you can leave in the pool. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final ThreadPoolManager singleton
private ThreadPool pool
private boolean started
Constructor Detail |
private ThreadPoolManager()
Method Detail |
public static void setMaxThreads(int maxThreads)
maxThreads
- The new maxThreads valuepublic static void setMinSpareThreads(int minSpareThreads)
minSpareThreads
- The new minSpareThreads valuepublic static void setMaxSpareThreads(int maxSpareThreads)
maxSpareThreads
- The new maxSpareThreads valuepublic static int getMaxThreads()
public static int getMinSpareThreads()
public static int getMaxSpareThreads()
public static ThreadPoolManager getInstance()
public static void reset()
public void runIt(IThreadPoolRunnable r)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |