You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by X f <li...@yahoo.com> on 2003/02/25 23:51:26 UTC
TcpWorkerThread and ThreadPool in Tomcat JK
Hi, All:
I am confused on the codes in TcpWorkerThread and
ThreadPool classes in Tomcat.
These classes are for JK connector.
See following codes from Tomcat 4.1.8 release
-------------------------------------------------
while(endpoint.isRunning()) {
Socket s = null;
try {
s = endpoint.acceptSocket();
} catch (Throwable t) {
endpoint.log("Exception in acceptSocket", t);
}
if(null != s) {
// Continue accepting on another thread...
endpoint.tp.runIt(this);
try {
if(endpoint.getServerSocketFactory()!
=null) {
-------------------------------------------------
acceptSocket would be blocked untill a socket
connecting to the server. If s is not null, it
will call ThreadPool to run this TcpWorkThread.
ThreadPool will call ControlRunnable to execute
the above codes again.
So when does this recursive calling quit?
Another question is about the ThreadPool. It uses
an array to manage a number of ControlRunnable. In
returnController function
-----------------------------------------------------
protected synchronized void returnController
(ControlRunnable c) {
if(0 == currentThreadCount || stopThePool) {
c.terminate();
return;
}
currentThreadsBusy--;
pool[currentThreadCount - currentThreadsBusy -1] = c;
notify();
}
-----------------------------------------------------
Would this overwrite the ControllRunable object in
position currentThreadCount-currentThreadsBusy-1?
Is there any information to explain this
ThreadPool and TcpWorkerThread?
Thanks a lot.
Cheers
linkspeed
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org