tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janek Bogucki <>
Subject How to list all Threads in the JVM? (Includes suggestion.)
Date Wed, 05 Jun 2002 13:05:08 GMT

We are trying to monitor the set of Threads in the JVM running Tomcat in order to fix a resource
exhaustion problem we have. (Tomcat and/or our code is increasing the number of threads until
hard nproc limit in /etc/security/limits.conf for the user is reached. Red Hat Linux 7.2)

How can I code this? This is probably a basic Java question but how do I reference to the
level ThreadGroup? With this code

    ThreadGroup tg = Thread.currentThread().getThreadGroup() ;
    while ( tg.getParent() != null)
        tg = tg.getParent() ;

    /* walk hierachy from tg */

would the code encounter problems with security manager restrictions when methods are invoked
the root object?

In addition to the actual code to walk the Thread tree does anyone have a suggestion as to
classloader I should put the code in? Does it matter?

Many Thanks for any suggestions,

Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message