javamultithreadingvisualvmjconsolejstack

Java Thread monitoring. How to find out non daemon live threads?


I see in JConsole that I still have 2 non daemon threads but I can't find out which exactly (total number of thread is beyond 30).
Visual VM doesn't provide such information.


Solution

  • Run:

    $ jstack PID | grep tid= | grep -v daemon
    

    This will dump all the thread of a given Java PID, filter lines with thread names and filter out non-daemon ones.

    Remove -v to print daemon threads only.