Java Doc for ThreadPool.java in  » Sevlet-Container » apache-tomcat-6.0.14 » org » apache » tomcat » util » threads » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Sevlet Container » apache tomcat 6.0.14 » org.apache.tomcat.util.threads 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.tomcat.util.threads.ThreadPool

ThreadPool
public class ThreadPool (Code)
A thread pool that is trying to copy the apache process management. Should we remove this in favor of Doug Lea's thread package?
author:
   Gal Shachor
author:
   Yoav Shapira

Inner Class :public static class MonitorRunnable implements Runnable
Inner Class :public static class ControlRunnable implements Runnable
Inner Class :public static interface ThreadPoolListener

Field Summary
final public static  intMAX_SPARE_THREADS
    
final public static  intMAX_THREADS
    
final public static  intMAX_THREADS_MIN
    
final public static  intMIN_SPARE_THREADS
    
final public static  intWORK_WAIT_TIMEOUT
    
protected  intcurrentThreadCount
    
protected  intcurrentThreadsBusy
    
protected  booleanisDaemon
    
protected  Vectorlisteners
    
protected  intmaxSpareThreads
    
protected  intmaxThreads
    
protected  intminSpareThreads
    
protected  MonitorRunnablemonitor
    
protected  Stringname
    
protected  ControlRunnable[]pool
    
protected  intsequence
     Sequence.
protected  booleanstopThePool
    
protected  intthreadPriority
     Thread priority.
protected  Hashtablethreads
     The threads that are part of the pool.

Constructor Summary
public  ThreadPool()
     Constructor.

Method Summary
public  voidaddThread(Thread t, ControlRunnable cr)
    
public  voidaddThreadPoolListener(ThreadPoolListener tpl)
    
protected  voidadjustLimits()
    
protected synchronized  voidcheckSpareControllers()
     Called by the monitor thread to harvest idle threads.
public static  ThreadPoolcreateThreadPool(boolean jmx)
     Create a ThreadPool instance.
Parameters:
  jmx - UNUSED ThreadPool instance.
public  intgetCurrentThreadCount()
    
public  intgetCurrentThreadsBusy()
    
public  booleangetDaemon()
    
public static  intgetDebug()
    
public  intgetMaxSpareThreads()
    
public  intgetMaxThreads()
    
public  intgetMinSpareThreads()
    
public  MonitorRunnablegetMonitor()
    
public  StringgetName()
    
public  intgetSequence()
    
public  String[]getThreadParam()
     Return an array with the current "param" ( XXX better name ? ) of each thread.
public  intgetThreadPriority()
     Returns the priority level of current and future threads in this pool.
public  String[]getThreadStatus()
     Return an array with the status of each thread.
public  EnumerationgetThreads()
    
public  intincSequence()
    
public  booleanisDaemon()
    
 voidlog(String s)
    
protected synchronized  voidnotifyThreadEnd(ControlRunnable c)
     Inform the pool that the specific thread finish.
protected  voidopenThreads(int toOpen)
     Create missing threads.
public  voidremoveThread(Thread t)
    
protected synchronized  voidreturnController(ControlRunnable c)
     Returns the thread to the pool.
public  voidrun(Runnable r)
    
public  voidrunIt(ThreadPoolRunnable r)
     Executes a given Runnable on a thread in the pool, block if needed.
public  voidsetDaemon(boolean b)
     The default is true - the created threads will be in daemon mode.
public  voidsetMaxSpareThreads(int maxSpareThreads)
    
public  voidsetMaxThreads(int maxThreads)
    
public  voidsetMinSpareThreads(int minSpareThreads)
    
public  voidsetName(String name)
    
public synchronized  voidsetThreadPriority(int threadPriority)
     Sets the thread priority for current and future threads in this pool.
public synchronized  voidshutdown()
    
public synchronized  voidstart()
    
public  StringthreadStatusString()
     Debug display of the stage of each thread.

Field Detail
MAX_SPARE_THREADS
final public static int MAX_SPARE_THREADS(Code)



MAX_THREADS
final public static int MAX_THREADS(Code)



MAX_THREADS_MIN
final public static int MAX_THREADS_MIN(Code)



MIN_SPARE_THREADS
final public static int MIN_SPARE_THREADS(Code)



WORK_WAIT_TIMEOUT
final public static int WORK_WAIT_TIMEOUT(Code)



currentThreadCount
protected int currentThreadCount(Code)



currentThreadsBusy
protected int currentThreadsBusy(Code)



isDaemon
protected boolean isDaemon(Code)



listeners
protected Vector listeners(Code)



maxSpareThreads
protected int maxSpareThreads(Code)



maxThreads
protected int maxThreads(Code)



minSpareThreads
protected int minSpareThreads(Code)



monitor
protected MonitorRunnable monitor(Code)



name
protected String name(Code)
Name of the threadpool



pool
protected ControlRunnable[] pool(Code)



sequence
protected int sequence(Code)
Sequence.



stopThePool
protected boolean stopThePool(Code)



threadPriority
protected int threadPriority(Code)
Thread priority.



threads
protected Hashtable threads(Code)
The threads that are part of the pool. Key is Thread, value is the ControlRunnable




Constructor Detail
ThreadPool
public ThreadPool()(Code)
Constructor.




Method Detail
addThread
public void addThread(Thread t, ControlRunnable cr)(Code)



addThreadPoolListener
public void addThreadPoolListener(ThreadPoolListener tpl)(Code)



adjustLimits
protected void adjustLimits()(Code)



checkSpareControllers
protected synchronized void checkSpareControllers()(Code)
Called by the monitor thread to harvest idle threads.



createThreadPool
public static ThreadPool createThreadPool(boolean jmx)(Code)
Create a ThreadPool instance.
Parameters:
  jmx - UNUSED ThreadPool instance. If JMX support is requested, you need tocall register() in order to set a name.



getCurrentThreadCount
public int getCurrentThreadCount()(Code)



getCurrentThreadsBusy
public int getCurrentThreadsBusy()(Code)



getDaemon
public boolean getDaemon()(Code)



getDebug
public static int getDebug()(Code)



getMaxSpareThreads
public int getMaxSpareThreads()(Code)



getMaxThreads
public int getMaxThreads()(Code)



getMinSpareThreads
public int getMinSpareThreads()(Code)



getMonitor
public MonitorRunnable getMonitor()(Code)



getName
public String getName()(Code)



getSequence
public int getSequence()(Code)



getThreadParam
public String[] getThreadParam()(Code)
Return an array with the current "param" ( XXX better name ? ) of each thread. This is typically the last request. The params of all threads



getThreadPriority
public int getThreadPriority()(Code)
Returns the priority level of current and future threads in this pool. The priority



getThreadStatus
public String[] getThreadStatus()(Code)
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 ) The status of all threads



getThreads
public Enumeration getThreads()(Code)



incSequence
public int incSequence()(Code)



isDaemon
public boolean isDaemon()(Code)



log
void log(String s)(Code)



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



openThreads
protected void openThreads(int toOpen)(Code)
Create missing threads.
Parameters:
  toOpen - Total number of threads we'll have open



removeThread
public void removeThread(Thread t)(Code)



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



run
public void run(Runnable r)(Code)



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



setDaemon
public void setDaemon(boolean b)(Code)
The default is true - the created threads will be in daemon mode. If set to false, the control thread will not be daemon - and will keep the process alive.



setMaxSpareThreads
public void setMaxSpareThreads(int maxSpareThreads)(Code)



setMaxThreads
public void setMaxThreads(int maxThreads)(Code)



setMinSpareThreads
public void setMinSpareThreads(int minSpareThreads)(Code)



setName
public void setName(String name)(Code)



setThreadPriority
public synchronized void setThreadPriority(int threadPriority)(Code)
Sets the thread priority for current and future threads in this pool.
Parameters:
  threadPriority - The new priority
throws:
  IllegalArgumentException - If the specifiedpriority is less than Thread.MIN_PRIORITY ormore than Thread.MAX_PRIORITY



shutdown
public synchronized void shutdown()(Code)
Stop the thread pool



start
public synchronized void start()(Code)



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



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.