PLEASE REMOVE ME FROM YOUR MAILING LIST. I DO NOT KNOW WHO YOU ARE. THANK
YOU...
----- Original Message -----
From: "Shapira, Yoav" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, June 05, 2002 9:29 AM
Subject: RE: How to list all Threads in the JVM? (Includes suggestion.)


Howdy,
Your basic code snippet worked relatively well.  In fact, I liked it
enough to start using it, with a few modifications and enhancements.
I'm attaching a more fully developed class to do some more, e.g. get a
list of all threads, etc.

You WILL get security (e.g. ThreadIllegalStateException) exceptions if
you try to modify thread groups outside your own.  For kicks, try the
destroyRootThreadGroup() method in the attached class. ;)

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Janek Bogucki [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, June 05, 2002 9:05 AM
>To: [EMAIL PROTECTED]
>Subject: 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:   <mailto:tomcat-user-
>[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:tomcat-user-
>[EMAIL PROTECTED]>




----------------------------------------------------------------------------
----


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


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

Reply via email to