Shapira, Yoav wrote:

Howdy,



So basically, I iknow this is off-topic for a tomcat-users page, but if
I wanted to track down all the threads that are opened within the JVM


at


any one time, and the nature of the threads (ie Daemon etc.) and where
they come from etc. can I do this?



Sure. If you send a SIGQUIT to the JVM at any point, including when it
appears hung, you will get a listing on your screen (or wherever you
have stdout directed) of all the currently running JVM threads and what
they're doing. I don't think that screen tells you if a given thread is
a daemon.


My first problem is the definition of the JVM, i cant find it as a process in its own right, I can only find the process for catalina, sending a SIGQUIT to:

/usr/local/j2sdk_nb/j2sdk1.4.2/bin/java -Djava.endorsed.dirs=/usr/local/tomcat/common/endorsed -classpath /usr/local/j2sdk_nb/j2sdk1.4.2/lib/tools.jar:/usr/local/tomcat/bin/bootstrap.jar -Djava.security.manager -Djava.security.policy==/usr/local/tomcat/conf/catalina.policy -Dcatalina.base=/us

isn't doing anything, but I cant seem to find the JVM process??
so i tried your alternative..

Alternatively, you can produce this information programmatically.  I've
posted code to the list in the past that does this (I think it was
called SystemThreadList or something like that).  It's a simple
recursive approach:

// Find root threadgroup
Thread thisThread = Thread.currentThread();
ThreadGroup tg = thisThread.getThreadGroup();
while(tg.getParent() != null) {
 tg = tg.getParent();
}

// Get all threads
int estimate = 2 * tg.activeCount();
Thread[] allThreads = new Thread[estimate];
tg.enumerate(allThreads);


Sure enough, in its own little progam it prints out all the threads. But I obviously need to embed it in Catalina somewhere, should I create a bean that does this??

Thanks
Sam


Now you list all threads, check daemon status, check the class (in case
it's a specific subclass extending Thread that you're looking for), etc.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to