Search code examples
javamultithreadingdaemonjvisualvm

getting a list of running non-daemon threads in jvisualvm


I am troubleshooting a shutdown that is not as graceful as it should be, so I would like to get a list of running non-daemon threads in jvisualvm (or other) to hunt the culprit.


Solution

  • jstack dumps all threads, there is a text that would tell if it is daemon or not

    ( jvisualvm produces same output in 'ThreadDump'- See this link for more useful documentation

     "Reference Handler" daemon prio=10 tid=0x00a98400 nid=0x1ee8 in Object.wait() [0x00b6f000]
               java.lang.Thread.State: WAITING (on object monitor)
                    at java.lang.Object.wait(Native Method)
                    at java.lang.Object.wait(Object.java:485)
                    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
                    - locked <0x19835fa0> (a java.lang.ref.Reference$Lock)
        
        "VM Thread" prio=10 tid=0x00a95800 nid=0x264 runnable