How to get Java thread dump in Linux?

You might want to take the Thread dump of JVM instance to check the state of your threads if its stop responding.

In linux you can use “kill -QUIT process_id” of the JVM instance to get the thred dump.

Thread dump can give you details like state of all threds in the JVM and the current memory usage generations.

kill -QUIT 2342

Full thread dump Java HotSpot(TM) 64-Bit Server VM (14.0-b16 mixed mode):

“TP-Monitor” daemon prio=10 tid=0x0000002b4013b800 nid=0x76c5 in Object.wait() [0x000000004163e000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on (a org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable)
at org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable.run(ThreadPool.java:565)
- locked (a org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable)
at java.lang.Thread.run(Thread.java:619)

“TP-Processor4″ daemon prio=10 tid=0x0000002b4094c000 nid=0x76c4 runnable [0x000000004153d000]
java.lang.Thread.State: RUNNABLE

In windows you can use “ctrl+pause” key to get the thread dump.

2 thoughts on “How to get Java thread dump in Linux?

Leave a comment

Your email address will not be published. Required fields are marked *