How to take a ThreadDump of a particular service
Solution:
- To take a thread dump of a particular service first, you need to get the PROCESS_ID of that particular service.
- Suppose, I want to get Thread Dump of Tomcat service. I need to provide the port number of the tomcat service.
- To find the PROCESS-ID of tomcat service, run the below command:
netstat -ano | find "Port_No" ]
Example:
netstat -ano | find "443"
- The above command returns the PROCESS-ID, now use the same process-id in below command to generate Thread Dump.
jcmd PROCESS-ID Thread.print > /opt/tmp/threadDump.txt