Thread and Heap dumps are useful for debugging any Java programme.
To get thread dump:
By using jstack command we can get thread dump of a Java process.
Example:
$ jstack PID
where PID is Java process id for which we want to get thread dump.
To get heap dump:
By using jmap command we can get heap dump of a Java process.
Exmaple:
$ jmap -heap PID
where PID is Java process id for which we want to get heap dump.