Ever wondered what each thread in the GlassFish is doing at any given point of time? Or Do you want to see where the objects are getting locked? Or Do you want to analyze the deadlock situation? Well, taking the snapshot of thread state (i.e. thread dumps) will help you in all these circumstances.

Lets see what are the different ways we can achieve this on GlassFish.

1. The Traditional Way
This is well known in the java community, i.e. sending kill -SIGQUIT [pid] (on solaris) or CTRL + BREAK (on windows) for the respective java process. This will dump the current stack trace of all the threads in the java process, in our case its GlassFish.

2. The Java SE Way
You know the answer. Yep, its the JConsole! Personally, I like the 'look and feel' of JConsole in Mustang (Jave SE 6) over Tiger (Java SE 5). Once you launch the Jconsole, you will be presented with the following connection setup screen.

GlassFish Installation Complete

Once you feed the {host,port} and {glassfish admin user , admin password}, you will be presented with the JConsole screen showing various monitoring stats like classes, memory, threads etc. If you click on the threads tab, you will be presented with the following screen showing stack trace for all the threads in the GlassFish.

GlassFish Installation Complete

3. The GlassFish Way
asadmin command line tool provides this nice feature to fetch the threads trace for a particular server instance you are interested in from a single point. Isn't it simple and convenient to have this information from a single location?

Here is the way to invoke it:

GlassFish Installation Complete

This will result in thread dump of the GlassFish, which look like the following:

GlassFish Installation Complete

I hope this information is useful for you. If you want to profile your application on glassfish then here is the nice read about the profiling tools.
Comments:

Post a Comment:
Comments are closed for this entry.

This blog copyright 2009 by bharath