Wednesday, September 17, 2014

Java 9 Tutorial

---

Java 9 features announced!

Coman Hamilton
Oracle has taken its development of Java 9 up a gear. A preliminary set of Java Enhancement Proposals (JEPs) for the next major release 9 has appeared on OpenJDK. And this time, Oracle are talking real features. Previous early access releases of JDK9 were restricted exclusively to “bug fixes and small enhancements only”.

New APIs and performance features

The next release is to feature three new APIs:
  1. lightweight JSON API for consuming and generating JSON documents and data streams
  2. HTTP 2 Client that will bring HTTP 2.0 and websockets, while replacing the legacy HttpURLConnection
  3. Process API Updates to improve controlling and managing operating-system process (developers were often forced to use native code with the current API)
Along with several other smaller features, as well as dozens of proposals already being tracked by the JEP Index, Oracle has also promised another trio of performance features:
  1. Improve contended locking, which aims at improving performance when threads compete over access to objects
  2. Segmented code cache with better performance, shorter sweep times, less fragmentation and further extensions to come
  3. The Smart Java compiler, or sjavac, will be improved to allow default use in the JDK build and general use for building larger projects 
Java’s native interface will also be revisited as part of the Java Native Runtime project, which was hinted at during the JavaOne in 2011, when Oracle also discussed a Java 9 release in 2016 featuring improved support for multi-gigabyte heaps and a self-tuning JVM.

Modular Source Code

If these features haven’t already whet your appetite, then Oracle’s promise of modular source code surely will. JEP 201 is aiming to reorganise the source code of the JDK into modules, and thereby essentially lay the foundations for a structured implementation of Project Jigsaw.
Jigsaw, which was dropped from Java 7 and pushed back to Java 9, remains one of the biggest talking points of Oracle’s next release. The chief goals of the project are to provide to scalability for smaller devices, improved security for the JDK and Java SE, enhanced performance and easier construction of libraries and large applications. Meanwhile, thePenrose Project is exploring interoperability between Jigsaw and the Open Source Gateway initiative.
Georges Saab, VP of Software Development at Oracle’s Java Platform Group previously told JAXenter that work is progressing on the Jigsaw project and the the development team “is exploring and prototyping a simplified approach” to ensure that it’s ready in time for Java 9.

A turbulent release history

However Oracle has been know to struggle with the punctuality of its Java releases. Numerous setbacks, such as the trickier-than-expected Project Lambda and the infamous applet-based security issues forced the company to push back the release of Java 8 by a total of two years. And even since then, an update of Java 8 has reportedly been causing numerous dev tools to break down.
Java 9 is currently planned for 2016, giving Oracle less than two years (as opposed to the usual three) to ready the new release, but also leaving plenty of time for requestsrumours, feature announcements and the inevitable delays.