6

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.

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
Rom1
  • 3,167
  • 2
  • 22
  • 39
  • 1
    You can just press ctrl+break to get a listing of all running threads with addtional information - not the most comfortable tool but guaranteed to work and does what you need. – Voo Jan 24 '12 at 09:31
  • 1
    Thanks! (note to myself: it is `ctrl-\' on Linux) – Rom1 Jan 24 '12 at 09:42

1 Answers1

1

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
Jayan
  • 18,003
  • 15
  • 89
  • 143