How to get the number of threads in a Java process
Useful tool for debugging java programs, it gives the number of threads and other relevant info on them:
jconsole <process-id>
java.lang.Thread.activeCount()
It will return the number of active threads in the current thread's thread group.
docs: http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#activeCount()
ManagementFactory.getThreadMXBean().getThreadCount()
doesn't limit itself to thread groups as Thread.activeCount()
does.