|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jcs.utils.threads.ThreadPool
A thread pool that is trying to copy the apache process management. asmuts -- Pulled out of tomcat, since it seems to move around and hide. Trying to reduce the number of dependencies
Nested Class Summary | |
(package private) class |
ThreadPool.ControlRunnable
A Thread object that executes various actions ( IThreadPoolRunnable ) under control of ThreadPool |
(package private) class |
ThreadPool.MonitorRunnable
Periodically execute an action - cleanup in this case |
Field Summary | |
protected int |
currentThreadCount
Description of the Field |
protected int |
currentThreadsBusy
Description of the Field |
private static org.apache.commons.logging.Log |
log
|
(package private) static boolean |
logfull
|
static int |
MAX_SPARE_THREADS
Description of the Field |
static int |
MAX_THREADS
Description of the Field |
protected int |
maxSpareThreads
Description of the Field |
protected int |
maxThreads
Description of the Field |
static int |
MIN_SPARE_THREADS
Description of the Field |
protected int |
minSpareThreads
Description of the Field |
protected ThreadPool.MonitorRunnable |
monitor
Description of the Field |
protected java.util.Vector |
pool
Description of the Field |
protected boolean |
stopThePool
Description of the Field |
static int |
WORK_WAIT_TIMEOUT
Description of the Field |
Constructor Summary | |
ThreadPool()
Constructor for the ThreadPool object |
Method Summary | |
protected void |
adjustLimits()
Description of the Method |
protected void |
checkSpareControllers()
Called by the monitor thread to harvest idle threads. |
int |
getMaxSpareThreads()
Gets the maxSpareThreads attribute of the ThreadPool object |
int |
getMaxThreads()
Gets the maxThreads attribute of the ThreadPool object |
int |
getMinSpareThreads()
Gets the minSpareThreads attribute of the ThreadPool object |
(package private) void |
log(java.lang.String s)
Description of the Method |
static void |
logFull(org.apache.commons.logging.Log log,
int currentThreadCount,
int maxThreads)
Description of the Method |
protected void |
notifyThreadEnd(ThreadPool.ControlRunnable c)
Inform the pool that the specific thread finish. |
protected void |
openThreads(int toOpen)
Description of the Method |
protected void |
returnController(ThreadPool.ControlRunnable c)
Returns the thread to the pool. |
void |
runIt(IThreadPoolRunnable r)
Executes a given Runnable on a thread in the pool, block if needed. |
void |
setMaxSpareThreads(int maxSpareThreads)
Sets the maxSpareThreads attribute of the ThreadPool object |
void |
setMaxThreads(int maxThreads)
Sets the maxThreads attribute of the ThreadPool object |
void |
setMinSpareThreads(int minSpareThreads)
Sets the minSpareThreads attribute of the ThreadPool object |
void |
shutdown()
Stop the thread pool |
void |
start()
Description of the Method |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final org.apache.commons.logging.Log log
public static final int MAX_THREADS
public static final int MAX_SPARE_THREADS
public static final int MIN_SPARE_THREADS
public static final int WORK_WAIT_TIMEOUT
protected java.util.Vector pool
protected ThreadPool.MonitorRunnable monitor
protected int maxThreads
protected int minSpareThreads
protected int maxSpareThreads
protected int currentThreadCount
protected int currentThreadsBusy
protected boolean stopThePool
static boolean logfull
Constructor Detail |
public ThreadPool()
Method Detail |
public void start()
public void setMaxThreads(int maxThreads)
maxThreads
- The new maxThreads valuepublic int getMaxThreads()
public void setMinSpareThreads(int minSpareThreads)
minSpareThreads
- The new minSpareThreads valuepublic int getMinSpareThreads()
public void setMaxSpareThreads(int maxSpareThreads)
maxSpareThreads
- The new maxSpareThreads valuepublic int getMaxSpareThreads()
public void runIt(IThreadPoolRunnable r)
public static void logFull(org.apache.commons.logging.Log log, int currentThreadCount, int maxThreads)
public void shutdown()
protected void checkSpareControllers()
protected void returnController(ThreadPool.ControlRunnable c)
protected void notifyThreadEnd(ThreadPool.ControlRunnable c)
protected void adjustLimits()
protected void openThreads(int toOpen)
void log(java.lang.String s)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |