How can I find out how many threads are running in the JVM?

Fredrik Appelberg

I believe you can call getParent() recursively on the current ThreadGroup (System.currentThread().getThreadGroup()) until you find the toplevel ThreadGroup. Then call enumerate to get an array with all threads. This seems pretty wasteful, though, and I'm sure there is a better way to do it.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact