Java 9 – Top 5 features and release Information

Soon after the release of Java 8 in March 2014, Java 9 was expected to be released in 2016 and and now a complete schedule is out. According to this schedule, jdk9’s general availability is in September 2016, announced by Mark Reinhold, Chief Architect of the Java Platform Group.
For those of you who want to be on the bleeding edge, JDK 9 early access builds are already available  here.

JDK 9 Schedule ( Reference )

  • 2015-12-10 – Feature Complete – All features implemented and integrated into the master forest
  • 2016-02-04 – All Tests Run – All planned tests have been run on all supported platforms
  • 2016-02-25 – Rampdown Start – Increased level of scrutiny is applied to incoming changes
  • 2016-04-21 – Zero Bug Bounce – The bug backlog is completely addressed
  • 2016-06-16 – Ramp down Phase 2 – A second round of checks is applied to incoming changes
  • 2016-07-21 – Final Release Candidate – The final release candidate has been declared and submitted for testing
  • 2016-09-22 – General Availability – Final release, ready for production use

This release will be bundled with a lot of exciting features like Jigsaw project, much awaited Process API updates, JSON as part of java.util, a money handling API and significant performance updates.

Top 5 features of this release are –

1) Project Jigsaw – Modular Source Code

Although this feature was to be introduced in Java 8 but due to some significant delays this feature will now be a part of Java 9. In previous JDK like 8 or 7 a lot(in thousands) of classes were included in runtime whether they were required in the project or not. Jigsaw project is targeted to make Java modular and break JRE into interoperable components. This will define the JDK into modules and will decide which modules to be included at by defining module boundaries at runtime. This will benefit small computing devices and will significantly improve performance.

2) Lightweight JSON API

Although there are several API available for handling JSON but this will be included in java.util and much lighter in weight that other options available.

3) Process API updates

Updates in this API is aimed at making it easier and platform independent task to communicate with operating system processes in Java. Earlier before we had to access the native code or do special techniques to access such information and still have to take good care of the underlying operating system i.e. our code was system dependent but now this update uses the Java’s ability to interact with operating system and solve all that at the backend making life of developers easier.

4) Segmented Code Cache

This is another performance update for Java 9. In this compiled code will be cached in different segments and each segment has a life and this is defined by how frequently certain areas of codes are executed. This area is divided into three segments –

  • Short duration cache – Code will stay for a short duration of time and this is specific to certain conditions
  • Long duration – Code will stay there for much longer time duration
  • Infinitely long duration – In this code will stay forever(JVM internal or non-method code)

Due to this segmentation a lot of improvements in the performance can be seen.

5) Money and Currency API

I want to quote a short section from the specification that pretty much sums up the motivation for this new API:

Monetary values are a key feature of many applications, yet the JDK provides little or no support. The existing java.util.Currency class is strictly a structure used for representing current ISO 4217 currencies, but not associated values or custom currencies. The JDK also provides no support for monetary arithmetic or currency conversion, nor for a standard value type to represent a monetary amount.

Java 9 brings with it a new and official API to represent, transport and perform comprehensive calculations with Money and Currency. Here are few code samples –

// getting CurrencyUnits by currency code
CurrencyUnit euro = MonetaryCurrencies.getCurrency("EUR");
CurrencyUnit usDollar = MonetaryCurrencies.getCurrency("USD");

// getting CurrencyUnits by locale
CurrencyUnit yen = MonetaryCurrencies.getCurrency(Locale.JAPAN);
CurrencyUnit canadianDollar = MonetaryCurrencies.getCurrency(Locale.CANADA);

// get MonetaryAmount from CurrencyUnit
CurrencyUnit euro = MonetaryCurrencies.getCurrency("EUR");
MonetaryAmount fiveEuro = Money.of(5, euro);

// get MonetaryAmount from currency code
MonetaryAmount tenUsDollar = Money.of(10, "USD");

// FastMoney is an alternative MonetaryAmount factory that focuses on performance
MonetaryAmount sevenEuro = FastMoney.of(7, euro);

Money and FastMoney are two new money types. FastMoney is 10-15 times faster that the other at a cost of loss of some precision in some cases.

A lot of features has been accepted which will be a part of Java 9 like –

  1. Improved Contended Locking
  2. Smart Java Compilation – Phase Two
  3. [Expected] HTTP 2 Client
  4. [ExpectedREPL in Java
  5. Unified JVM Logging
  6. Compiler Control
  7. Datagram Transport Layer Security (DTLS)
  8. HTML5 Javadoc
  9. Elide Deprecation Warnings on Import Statements
  10. Resolve Lint and Doclint Warnings
  11. Milling Project Coin
  12. Remove GC Combinations Deprecated in JDK 8
  13. Process Import Statements Correctly

References –

JDK 9 – Download
JDK 9 – Schedule and features

Do share the wisdom and motivate us to keep writing such online tutorials for free and do comment if anything is missing or wrong or you need any kind of help.

Keep Learning.. Happy Learning.. :)

  • Javid Ahammed

    Thanks a lot Mr.Hitesh Garg…

    How many of us have started using Java 8 ?

    • hiteshgarg21

      Define ‘us’ please?
      And how does it matters that how many of ‘us’ are using Java 8. If you are not using it, then you are lacking behind. Java 8 is awesome in many aspects.
      This is coding industry, either remain updated or someone else will replace you?