Analyze Thread Dump

Thread dump:
A thread dump is a list of all the Java threads that are currently active in a Java Virtual Machine (JVM).

How can I take thread dumps from a JVM on Windows/linux?
Using Jstack tool. Jstack comes along with java.

Type the following commands in cmd:
>Jstack

To get a list of Java processes(PID) running on a machine, jps may be used which returns id
>jps

To obtain a thread dump using jstack, run the following command:
eg.jstack <pid>
>Jstack 6856

How to get thread dumps to a file?
>jstack 6856 >> threaddumps.log

Note: File  threaddumps.log is automatically created.If your path in cmd is desktop then that file will be created in desktop

No comments:

Post a Comment