In Java, how will you take thread dump?

Answered

In Java, how will you take thread dump?

Ninja Asked on 18th September 2018 in Java.
Add Comment
1 Answer(s)
Best answer

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

It is highly recommended to take more than 1 thread dump. A good practice is to take multiple thread dumps at a regular interval. There are several ways to take thread dumps from a JVM:

  1. Get the PID of your java process. The first piece of information you will need to be able to obtain a thread dump is your java process’s PID. The JDK ships with the jps command which lists all java process ids.
  2. Request a Thread Dump from the JVM using jstack option. It prints thread dumps to the command line console. This tool is available as part of JDK since 5.0
Ninja Answered on 18th September 2018.
Add Comment