org.apache.tomcat.util.threads
Class ThreadPoolMX

java.lang.Object
  |
  +--org.apache.tomcat.util.threads.ThreadPool
        |
        +--org.apache.tomcat.util.threads.ThreadPoolMX

public class ThreadPoolMX
extends ThreadPool

Manageable thread pool

Author:
Costin Manolache

Nested Class Summary
 
Nested classes inherited from class org.apache.tomcat.util.threads.ThreadPool
ThreadPool.ControlRunnable, ThreadPool.MonitorRunnable, ThreadPool.ThreadPoolListener
 
Field Summary
protected  java.lang.String domain
           
protected  java.lang.String name
           
 
Fields inherited from class org.apache.tomcat.util.threads.ThreadPool
currentThreadCount, currentThreadsBusy, isDaemon, listeners, MAX_SPARE_THREADS, MAX_THREADS, maxSpareThreads, maxThreads, MIN_SPARE_THREADS, minSpareThreads, monitor, pool, stopThePool, threads, WORK_WAIT_TIMEOUT
 
Constructor Summary
ThreadPoolMX()
           
 
Method Summary
 void addThread(java.lang.Thread t, ThreadPool.ControlRunnable cr)
           
 void addThreadPoolListener(ThreadPool.ThreadPoolListener tpl)
           
protected  void notifyThreadEnd(ThreadPool.ControlRunnable c)
          Inform the pool that the specific thread finish.
 void removeThread(java.lang.Thread t)
           
protected  void returnController(ThreadPool.ControlRunnable c)
          Returns the thread to the pool.
 void runIt(ThreadPoolRunnable r)
          Executes a given Runnable on a thread in the pool, block if needed.
 void shutdown()
          Stop the thread pool
 void start()
           
 java.lang.String[] threadParam()
          Return an array with the current "param" ( XXX better name ?
 java.lang.String[] threadStatus()
          Return an array with the status of each thread.
 java.lang.String threadStatusString()
          Debug display of the stage of each thread.
 
Methods inherited from class org.apache.tomcat.util.threads.ThreadPool
adjustLimits, checkSpareControllers, createThreadPool, getCurrentThreadCount, getCurrentThreadsBusy, getDaemon, getDebug, getMaxSpareThreads, getMaxThreads, getMinSpareThreads, getMonitor, getThreads, isDaemon, logFull, openThreads, setDaemon, setMaxSpareThreads, setMaxThreads, setMinSpareThreads
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

domain

protected java.lang.String domain

name

protected java.lang.String name
Constructor Detail

ThreadPoolMX

public ThreadPoolMX()
Method Detail

start

public void start()
Overrides:
start in class ThreadPool

addThread

public void addThread(java.lang.Thread t,
                      ThreadPool.ControlRunnable cr)
Overrides:
addThread in class ThreadPool

removeThread

public void removeThread(java.lang.Thread t)
Overrides:
removeThread in class ThreadPool

addThreadPoolListener

public void addThreadPoolListener(ThreadPool.ThreadPoolListener tpl)
Overrides:
addThreadPoolListener in class ThreadPool

runIt

public void runIt(ThreadPoolRunnable r)
Executes a given Runnable on a thread in the pool, block if needed.

Overrides:
runIt in class ThreadPool

shutdown

public void shutdown()
Stop the thread pool

Overrides:
shutdown in class ThreadPool

returnController

protected void returnController(ThreadPool.ControlRunnable c)
Returns the thread to the pool. Called by threads as they are becoming idel.

Overrides:
returnController in class ThreadPool

notifyThreadEnd

protected void notifyThreadEnd(ThreadPool.ControlRunnable c)
Inform the pool that the specific thread finish. Called by the ControlRunnable.run() when the runnable throws an exception.

Overrides:
notifyThreadEnd in class ThreadPool

threadStatusString

public java.lang.String threadStatusString()
Debug display of the stage of each thread. The return is html style, for display in the console ( it can be easily parsed too )

Returns:

threadStatus

public java.lang.String[] threadStatus()
Return an array with the status of each thread. The status indicates the current request processing stage ( for tomcat ) or whatever the thread is doing ( if the application using TP provide this info )

Returns:

threadParam

public java.lang.String[] threadParam()
Return an array with the current "param" ( XXX better name ? ) of each thread. This is typically the last request.

Returns:


Copyright © 2001 Apache Software Foundation. All Rights Reserved.