Tuesday, January 22, 2008

Java SE 6 and JMX

Java 1.4.2 and Java 5 delivered huge advancements for Java developers, but Java SE 6 has provided several very nice new features. I covered two of the features of Java 6 (built-in annotations processing and built-in JAXB support) in my Oracle Technology Network article Better JPA, Better JAXB, and Better Annotations Processing with Java SE 6.

Many of the new Java SE 6 features are covered in the book Java 6 Platform Revealed. Two features not covered in the book are JAX-WS support in Java SE 6 and the new additions Sun introduced for JMX in the Java platform. The managing and monitoring improvements in Java SE 6 are also discussed in the article What's New in Java SE 6. This blog entry focuses on the JMX enhancements because Java SE 6's addition of JMX to the platform improved significantly upon the JMX support first included with the Java 5 platform.

Before the advent of Java 5, the JMX reference implementation was available as a separate download. When JMX was included with J2SE 5, it was referenced as the "platform JMX implementation" and was distinct from the JMX reference implementation. With Java SE 6, the JMX implementation delivered as part of the platform was also considered the JMX reference implementation.

The JMX 1.4 Specification explains the history of the JMX reference implementation and the platform JMX implementations for J2SE 5 and Java SE 6. As described in Section 1.2.1 ("Reference Implementation") this specification (which is stored in the Java SE 6 documentation under http://java.sun.com/javase/6/docs/technotes/guides/jmx/JMX_1_4_specification.pdf),
there was no separately available JMX reference implementation as of JMX 1.3 and the JMX 1.4 RI (reference implementation) is included with Java SE 6. Thus, the platform JMX implementation in Java SE 6 is also the reference implementation of JMX. That definitely makes things less confusing than in the J2SE 5 situation where the reference implementation was separate from the J2SE 5 platform JMX implementation.

Section 1.2.3 ("JMX APIs as part of the Java Platform") of the JMX 1.4 Specification outlines the historical versioning of JMX specifications and the Java platforms. This section of the specification explains that the core JMX API and the JMX Remote API were included with the Java platform for the first time in J2SE 5 as JMX API 1.2 and JMX Remote API 1.0. In Java SE 6, both are included as JMX API 1.4 and JMX Remote API 1.4.

Sun also enhanced its support for JConsole from what was originally provided in J2SE 5. The improvements to JConsole in Java SE 6 include the Attach API, the Plugin API, and new (and I think improved) look and feel.

Differences between the man page documentation for J2SE 5 JConsole and Java SE 6 JConsole also point out a significant change in JConsole between the two versions. When you compare the man page documentation for both versions you'll notice that the note about JConsole being experimental and possibly being unavailable in future versions of the JDK is removed for the Java SE 6 documentation.

In addition to its improvements to JConsole, Java SE 6 also brought improvements to JMX by taking advantage of the newly added Attach API to remove the need to use the -Dcom.sun.management.jmxremote when running clients meant to connect to a JMX server.

Java SE 6 further improved upon platform JMX support by adding the MXBean. Other improvements to JMX via Java SE 6 include improved threading/concurrency support and additional support for SSL with remote connectors.

As I described in a previous blog entry, Sun's Java SE 6 SDK has delivered many useful features that make the Jsva developer's life easier. A more complete listing of the Java SE 6 enhancements to JMX is available here.

No comments: