You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Janek Bogucki <ja...@yahoo.co.uk> on 2002/06/05 15:05:08 UTC

How to list all Threads in the JVM? (Includes suggestion.)

Hi,

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 the
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 top
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 on
the root object?

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

Many Thanks for any suggestions,
Janek

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to list all Threads in the JVM? (Includes suggestion.)

Posted by anette mysel <ca...@cox.net>.
PLEASE REMOVE ME FROM YOUR MAILING LIST. I DO NOT KNOW WHO YOU ARE. THANK
YOU...
----- Original Message -----
From: "Janek Bogucki" <ja...@yahoo.co.uk>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Wednesday, June 05, 2002 8:21 AM
Subject: Re: How to list all Threads in the JVM? (Includes suggestion.)


> --- peter lin <pe...@labs.gte.com> wrote: >
> > use an application like optimizeIt or JProbe to profile the thread
> > usage. Warning though, don't try running it on a system with less than
> > 128mb of ram.
> >
> > peter
>
> Thanks for the links:
>
>     http://www.sitraka.com/software/jprobe/
>     http://www.borland.com/optimizeit/
>
> It's not really what I need right now. If I had a simple class that formed
the basis of a Thread
> which periodically dumped a list of all Threads in the JVM I'd be satified
(for now...JProbe
> Threadalyzer looks very useful!).
>
> Thanks,
> Janek
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to list all Threads in the JVM? (Includes suggestion.)

Posted by Janek Bogucki <ja...@yahoo.co.uk>.
 --- peter lin <pe...@labs.gte.com> wrote: > 
> use an application like optimizeIt or JProbe to profile the thread
> usage. Warning though, don't try running it on a system with less than
> 128mb of ram.
> 
> peter

Thanks for the links:

    http://www.sitraka.com/software/jprobe/
    http://www.borland.com/optimizeit/

It's not really what I need right now. If I had a simple class that formed the basis of a Thread
which periodically dumped a list of all Threads in the JVM I'd be satified (for now...JProbe
Threadalyzer looks very useful!).

Thanks,
Janek

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to list all Threads in the JVM? (Includes suggestion.)

Posted by peter lin <pe...@labs.gte.com>.
use an application like optimizeIt or JProbe to profile the thread
usage. Warning though, don't try running it on a system with less than
128mb of ram.

peter


Janek Bogucki wrote:
> 
> Hi,
> 
> 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 the
> 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 top
> 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 on
> the root object?
> 
> In addition to the actual code to walk the Thread tree does anyone have a suggestion as to which
> classloader I should put the code in? Does it matter?
> 
> Many Thanks for any suggestions,
> Janek
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>