Express (Distributed operating systems), v8.0 > Troubleshoot and support > Analyzing application server Java system dumps with the IBM Monitoring and Diagnostic Tools for Java - Dump Analyzer > Write Dump Analyzer modules for WAS diagnostics - Tutorial


Tutorial: Writing Dump Analyzer modules for WAS diagnostics


Integrate the Analyzer into the Tool Menu

Our analyzer is almost complete. It extracts all the information that we need, and generates a well-formatted report for it. The last thing that remains is to specify some meta-data that will allow the Dump Analyzer tool to recognize our analyzer class when it is loaded, and to display it properly in the menu of all available analyzers.

This is accomplished by providing an implementation for a few methods declared in the IAnalyzerBase interface. These implementations are not absolutely necessary, because a default implementation is provided in the base class that we extended to build our analyzer (WASAnalyzerBase). However, providing a custom implementation here allows to override the defaults provided by the base class and to provide useful information specific to this particular analyzer:

public class WASThreadPoolsSampleX extends WASAnalyzerBase implements IReport {

public String getName() { return "WASThreadPoolsSampleX"; }

public String getVersion() { return "1.0.0.20080310-EXPERIMENTAL(alpha)"; }

public String getShortDescription() { return getString("A sample analyzer that demonstrates how to write analysis modules (using WAS thread pools as an example)"); }

public String getLongDescription() { return ( getShortDescription() + "\n" + getVersion() + "\n" + "This is the complete version of the sample analyzer from the tutorial "Writing Dump Analyzer modules for WAS diagnostics"" + "provided with the Dump Analyzer tool documentation"); }

public boolean isPrimaryAnalyzer() { return true; }

public String[] getCategories() { return new String[] { getClass().getPackage().getName() }; }

}

getName() specifies the name by which this analyzer will be listed in the Dump Analyzer tool menu. If not specified, the default is the full class name of the Java class implementing this analyzer.

getVersion() specifies a version identification string associated with this analyzer. Currently, there is no semantics associated with this version string, other than simply displaying next to the analyzer name in the Dump Analyzer tool menu. By convention, we typically use a version string of the form x.y.z.datestamp, and append the string EXPERIMENTAL to distinguish between analyzers that have been more completely tested, and analyzers that are provided on an experimental basis. The tool itself does not do anything about this distinction; it is up to the user, when selecting an analyzer to invoke from the menu, to decide if he/she wishes to try-out some experimental analyzers or avoid them.

getShortDescription() specifies a short (one line only) description of this analyzer, that appears next to its name and version on the Dump Analyzer tool menu.

getLongDescription() can be used to provide a longer, multi-line description of this analyzer. If provided, that long description is displayed below the main Dump Analyzer tool menu, whenever that particular analyzer is currently selected in the menu.

isPrimaryAnalyzer() is used to control whether this analyzer should be listed in the Dump Analyzer tool menu or not. If this method returns true, the analyzer will be listed in the menu. If it returns false, the analyzer is still loaded and available in the tool, for invocation from other analyzers and from the interactive shell, but it is not visible in the menu. This is very useful to avoid cluttering the menu with a lot of "secondary" or "helper" analyzers that are never intended to be invoked directly. For example, all the wrapper analyzers that we mentioned in earlier sections of this tutorial, are normally set to not be displayed in the main menu. Note that for analyzers that are implemented by extending WASAnalyzerBase, the default implementation of isPrimaryAnalyzer() returns false. So we must override this implementation if we wish to make our new analyzer in the menu.

getCategories() controls where in the Dump Analyzer tool menu our analyzer should be displayed. The tool menu is organized as a hierarchy of categories. This method should return an array of strings that specify each of the menu categories under which we wish our analyzer to be listed (an analyzer may be listed in more than one category). By default, getCategories() returns a single category that corresponds to the Java package that contains the analyzer class. So in this case, since our sample analyzer was defined in the com.ibm.dtfj.analyzer.was.samples package, it will be shown in the menu under a category by the same name.


Next Topic


Putting it together: the complete source code for the WASThreadPoolsSample analyzer