We’ll explore how to capture a thread dump and analyze it effectively in this post. This is a continuation of Java Dumps Uncovered: When to Use Thread Dump, Heap Dump, or Core Dump . Quick Summary A thread dump helps determine if a thread is stuck. However, taking a single thread dump isn’t enough—we need at least two or more dumps to confirm whether a thread remains in the same state over time. Ways to Capture a Thread Dump There are multiple ways to take a thread dump. We’ll explore each method using a sample Java program that creates two threads—one terminating in 30 seconds and another in 5 minutes . The Java file is available in this gist . To capture a thread dump, the first step is to identify the Java process ID (PID) . This can be done using: $ jps or $ ps aux | grep java This command lists all running Java processes. Select the PID of the process for which you need the thread dump. ...