Dump thread information

There's a way of asking a Java Runtime to output a "thread dump" for all currently running threads (both system threads and application threads). For each thread, the thread dump will include a stack trace, and information on any locks currently held by the thread. Thread dumps don't cause your application to halt. They're like a snapshot: your application pauses execution, the running threads are queried, the information is output, and then your application simply resumes execution.

To cause a thread dump from the console that launched the application:

On Unix, you can also generate a thread dump from any console using these commands:

Note that this doesn't actually kill the process.

The precise syntax and content of a thread dump is dependent on the Java Runtime.

The JConsole and Visual VM tools also let you view thread information.

See Also :
Stack trace as String
Would you use this technique?
Yes   No   Undecided   
© 2018 Hirondelle Systems | Source Code | Contact | License | RSS
Individual code snippets can be used under this BSD license - Last updated on September 21, 2013.
Over 2,000,000 unique IPs last year - Built with WEB4J.
- In Memoriam : Bill Dirani -