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.
Asked
Active
Viewed 5,178 times
2 Answers
22
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.

Tomasz Nurkiewicz
- 334,321
- 69
- 703
- 674
-
unfortunately leaves a few odd threads in there, like GC threads, but close enough! :) – rogerdpack Jul 12 '13 at 17:21
-
1A tip for future readers: you can find jstack in your JDK's bin folder – Dana Cartwright Jul 20 '17 at 19:05
2
Take a thread dump in VisualVM. Daemon threads have the word 'daemon
' next to the thread name.
"Default RequestProcessor" daemon prio=1 tid=101e58000 nid=0x124d86000 runnable [124d85000]

Tomasz Nurkiewicz
- 334,321
- 69
- 703
- 674

Tomas Hurka
- 6,723
- 29
- 38