tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: [Fwd: Catalina suspends for no reason?!?]
Date Mon, 09 Feb 2004 18:40:08 GMT

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.

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);

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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message