JavaOne 2006 Conference is coming up soon! Our BOF "Using JConsole to Monitor and Manage Your Application" is on May 18, 2006 at 10:30pm. The 9:30pm BOF (same room) is the JDK Tools BOF. The Java SE serviceability team will be there. It's late at night but hope to see you there. We're going to do a live demo of the Mustang JConsole at the JConsole BOF.
Below gives you a summary of the Mustang JConsole features. Let us know what you think.
JConsole Plugin Support
JTop is a JDK demo that shows the thread CPU usage of all threads running in the application. This demo is helpful to identify the threads that has high CPU consumption. It is updated to be used as a standalone GUI as well as a JConsole plugin. To run JConsole with the JTop plugin:
<JDK6>/bin/jconsole -pluginpath <JDK6>/demo/management/JTop/JTop.jar
To build a JConsole plugin, it's very simple:
1. Create a subclass of JConsolePlugin class and implement the getTab method and also the newSwingWorker method. The getTab method returns the list of tabs to be added to JConsole or an empty list. The newSwingWorker method returns the SwingWorker to be responsible for the plugin's GUI update.
2. Create a file "META-INF/services/com.sun.tools.jconsole.JConsolePlugin" to contain the fully-qualified class name of the plugin class. JConsole uses the service-provider loading facility to look up and load the plugins. You can have multiple plugins - one entry per plugin.
Sundar added a new scripting demo to demonstrate the power of using scripting language with JMX technology and the out-of-the-box manageability. This scripting demo is built as a JConsole plugin. It adds a scripting shell tab in JConsole where you can access MBean attributes or operations using a scripting language. To try, run JConsole as follows:
<JDK6>/bin/jconsole -pluginpath <JDK6>/demo/scripting/jconsole-plugin/jconsole-plugin.jar
> memory=mbean("java.lang:type=Memory") # to get the MemoryMXBean > memory.Verbose # get the value of "Verbose" attribute > memory.Verbose=true # set the "Verbose" attribute to true > memory.gc() # invoke the gc() operation
Dynamic Attach Capability
JConsole can now attach to any applications running on Mustang JDK even if it wasn't started with -Dcom.sun.management.jmxremote option. This dynamic attach capability uses the attach API that Alan Bateman added in Mustang which enables a tool like JConsole to load the management agent in the target VM dynamically. It's a very useful feature and makes JConsole and the out-of-the-box management easier.
There are many UI improvements in Mustang JConsole. Just to highlight a few: (1) JConsole now is using the system look-and-feel on Windows and Gnome desktop. (2) The connection dialog has been improved for user experience and a new sheet dialog is designed for the progress bar. (3) The thread tab now has a new detect deadlock button that finds the deadlocks involved in object monitors and java.util.concurrent ownable synchronizers. See the blog about "Thread dump and concurrent locks".
Overview Tab and VM Summary Tab
A new overview tab is added in Mustang JConsole to plot multiple charts in one tab to provide an easy way for users to correlate various resource consumption. Previously you would have to switch among several tabs if you want to correlate the data such as memory usage, threads, and CPU usage. Another improvement is that we merge the Summary tab and VM tab into one single "VM Summary" tab where you can cut-and-paste the selected text into a report file.
JMX MBean Metadata and Descriptor
JMX Descriptor provides a convenient way to add additional metadata to your MBeans. Mustang JMX supports descriptors for all types of MBeans. Eamonn's blog describes an easy way to add descriptors to your MBeans. Mustang JConsole makes the MBean metadata and descriptor information visible in the MBean tab.
HotSpot Diagnostic MBean
Mustang adds a HotSpot Diagnostic MBean (see com.sun.management.HotSpotDiagnosticMBean) which provides an API to request heap dump at runtime and also change the setting of certain VM options. You can access the HotSpot Diagnostic MBean via JConsole MBean tab. See Sundar's blog about setting VM options and my blog about diagnosing memory problems.
Try the latest version of Mustang JConsole and send us feedback!