19 July, 2012

What is Thread Dump and how to create a Thread Dump

Thread Dump basically helps to track a activity of each thread.What are the job/task each thread is doing at a particular point of time we can get by thread dump.

To Create a thread dump in console Press Ctrl+Break from Key board.

Create a java program with infinite loop , at the time of running press Ctrl+Break key from key board and see the Full Thread dump is printed on console ( Now write that into a file).

Program :- xLoop.java

public class xLoop{     public static void main(String str[])
{     
       boolean x=true;             
       while(x)
{       
  System.out.println("Hello Manoj ");    
 }  } }

Now run this program on console and at the run time press Ctrl+Break , now the Full Thread Dump like below :-

Note- If any body find complex to find the Full Thread Dump message in the console , do some primary setup with your console window (command prompt). Change the CMD property-->Layout-->Height , set height to 2000 and CMD property-->options-->Buffer Size , set buffer size to 200.Now it will work and you can see this Dump messages.



No comments:

Post a Comment