wood burning stoves 2.0
The moose likes Threads and Synchronization and the fly likes ThreadGroup .activeCount() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "ThreadGroup .activeCount()" Watch "ThreadGroup .activeCount()" New topic

ThreadGroup .activeCount()

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
I have a simple jsp page that has the following info on it:
(removed the html and jsp tags)

Runtime rt = Runtime.getRuntime();
// forcibly suggest garbage collection

// get the primordial threadgroup
ThreadGroup tg = Thread.currentThread().getThreadGroup();
while (tg.getParent()!=null) { tg=tg.getParent(); }


Why does the value of tg.activeCount() get larger every time this page is called? Better yet, why does the value of tg.activeCount() never get smaller?
Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
Hi Anthony, I don�t know the answer to your question, but I have a suggestion. ThreadGroup.enumerate will give you a list of the active threads.
I agree. Here's the link: http://aspose.com/file-tools
subject: ThreadGroup .activeCount()
It's not a secret anymore!