Sunday, December 17, 2006

Java 6 is nice!

So Java 6 has been out in its final version for a few days now. Having participated (1, 2) in (a very small way) the development of it and having used it for more than a year and a half now I'm very happy about that. It is a very nice new version of Java. It does not involve such big changes to the language as Java 5 did, but instead it focuses on other things such as:

  • Compatibility/Stability –Highest priority for Java 6
  • Ease of development –DB access, scripting, compilation, gui design, annotation processing
  • Diagnosability, Monitoring & Management –Inspection of a running JVM, heap, threads etc, no flags needed
  • Enterprise Desktop –Catching up in key areas
  • XML & Web Services –Web service stack etc
  • Transparency -Insight into the evolution of the Java platform

... and of course performance again.

I'm to hold a presentation on the new stuff of Java 6 after the holidays and if anyone else would like me to hold a short introduction (or longer) send me an email.

Performance (it was codenamed Mustang after all) is very good in Java 6. This is a bit extreme but still a fairly interesting benchmark from the author of JFreeChart (a very nice piece of software). Results:

  • SUN Java 6: 70 charts/s
  • SUN Java 5: 20 charts/s
  • Jam VM: 1-2 charts/s

Java 2D performance has gotten some considerable performance improvements, probably shown to good advantage in this test. Even perceived performance is important of course and the "gray rectangle" update problem has been solved in Java 6 (April 2005).

Urban performance legends, revisited -Brian Goetz writes some very good articles, this one from 2005 mentions some of the Java 6 VM features such as escape analysis, which will be taken advantage of more in JDK 7.

More Swing/Java2D performance tests (March 2006) show 30-50% performance increases.

David Dagastine's (Sun) blog about Java performance contains a lot of nice performance charts including data for Java 6. Some (1, 2) even comparing Java to C/C++, and guess which one wins...

Other neat stuff
One nice feature is how easy it is to provide a webservice now, without anything other than the JDK. Just add a @WebService annotation and then just call Endpoint.publish(...). That's it!

Scripting support so pluggable scripting engines can run in/by the JVM, easy and handy. Combine this with the fact that Sun recently hired some of the JRuby people, quite interesting!

The simple thing I contributed along with unit tests was "IOException supports exception chaining via the addition of the new constructors IOException(String, Throwable) and IOException(Throwable)."

The File class now provides methods to retrieve disk information (total, free, usable) as well as to set or query file permissions.

Attach JConsole and other such analysis tools without having to specify any special flags when you started the JVM and other great enhancements to the monitoring and management stuff.

Swing has a wide range of improvements and ready for Windows Vista (something that is being backported to Java 5) and integrates with the desktop of modern OSes a lot better (tray support, starting file type associated applications, system mail reader and web browser, splash screen before VM is loaded etc). JDBC 4.0 seems like a nice upgrade I must say too, making the driver set up easier and providing some new features of course.

Danny Coward has a very nice top ten list with a nice table of summaries and blogs related to the particular items on that list.

List of New Features and enhancements in Java 6.

And after 6 comes...?
JDK 7, previously known as “Dolphin”. Features being discussed:

  • Open source, from the start
  • Modular, Kernel Java –initial small download
  • Dynamically typed language support
  • Persistence Architecture
  • JavaDoc update
  • JMX and Web Service management
  • Swing application easier with Beans Binding and simple mini application framework.
  • More NIO, Closures, block constructs, strings in switch statements, properties, XMLS inside the language
  • ... what would you like?