I am looking for a way to get the number of threads in a JAVA VM, using JAVA code. Any ideas?
Many thanks in advance
I am looking for a way to get the number of threads in a JAVA VM, using JAVA code. Any ideas?
Many thanks in advance
Try this:
Thread.getAllStackTraces().size()
I think, you can also get it using JMX using ThreadMXBean management interface. Here is a sample.