Monitoring and Management
Java 6 has made some good progress in the field of application monitoring, management, and debugging. The Java Monitoring and Management Console, or JConsole, is well known to system administrators who deploy Java applications (see
Figure 1). First appearing in Java 5, JConsole is a graphical monitoring tool based on JMX, which provides a very complete view of the performance and resource consumption of Java applications.

Java 6 enhances JConsole in several ways, making it both easier to use and more powerful. The graphical look has been improved; you can now monitor several applications in the same JConsole instance, and the summary screen (shown in Figure 1) has been redesigned. It now displays a graphical dashboard of the key statistics. You also can now export any graph data in CSV form for further analysis in a spreadsheet.
One great thing about application monitoring in Java 6 is that you don't need to do anything special to your application to use it. In Java 5, you needed to start any application that you wanted to monitor with a special command-line option (-Dcom.sun.management.jmxremote). In Java 6, you can monitor any application that is running in a Java 6 VM.
Java 6 comes with sophisticated thread-management and monitoring features as well. The Java 6 VM can now monitor applications for deadlocked threads involving object monitors and java.util.concurrent ownable synchronizers. If your application seems to be hanging, JConsole lets you check for deadlocks by clicking on the Detect Deadlock button in the Threads tab.
At a lower level, Java 6 helps resolve a common hard-to-isolate problem: the dreaded java.lang.OutOfMemoryError. In Java 6, an OutOfMemoryError will not just leave you guessing; it will print out a full stack trace so that you can have some idea of what might have caused the problem.