The Tomcat Manager reports a different thread count than ThreadMXBean. The number of threads reported by ThreadMXBean is the same as the number of threads reported in the YourKit profiler as well. Is there a difference between Tomcat threads and JVM threads?
Line from Tomcat Manager:
Max threads: 200 Current thread count: 7 Current thread busy: 3
ManagementFactory.getThreadMXBean().getThreadCount():
38
Tomcat thread are request processing threads, and does not count other thread that the application may have started.
For a better look on what those other thread are, take a look at Thread.getAllStackTraces()
.
According to the javadocs, ManagementFactory.getThreadMXBean().getThreadCount()
:
Returns the current number of live threads including both daemon and non-daemon threads.
Therefore, the JVM could very well have 38 different threads going (mostly in the background). Tomcat makes a new thread for each request (so that it can have concurrent communication). It would make sense that these two numbers could differ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With