JEP 285: Small But Perfectly Formed


Last month I gave a keynote presentation at the Riga Dev Days on “Open Source and OpenJDK: Do They Deliver?” One of the key themes of this was looking at how much involvement there is in the OpenJDK project from outside of Oracle (and Sun before it was acquired).

Earlier this month a small but, in my opinion, significant event occurred in the OpenJDK project: the pushing of two patches (consisting of 39 lines of code for the JDK and 172 lines for the JVM) into the source tree.

There are three reasons why this event is significant:

  1. This is the implementation of the changes proposed in JDK Enhancement Proposal (JEP) 285, which is the first proposed by Azul Systems.
  2. This is one of only four JEPs (that I can find) proposed by people outside of Oracle (the other three being JEP 237 from Red Hat, JEP 258 from IBM and JEP 266 from Doug Lea).
  3. Probably the most significant fact is that this introduces a new method, onSpinWait(), to the Thread class. Thread is a pretty fundamental class in Java and in twenty years has only been modified in three previous releases:
  • JDK 1.2 added two methods: get/setContextClassLoader()
  • JDK 1.4 added a new constructor that included a size parameter for the stack and a new method, holdsLock().
  • JDK 5 added eight new methods related to stack traces, exception handlers as well as getState() and getId().I’m pretty certain this is the first time a change to Thread has come from ouutside Sun/Oracle (feel free to correct me if I’m wrong).

What these two hundred lines of codes show is that the process works the way it was designed to. It demonstrates that it is possible for people outside of Oracle, with good ideas for changes, can get them integrated into the core Java platform via the OpenJDK project.

The challenge, then, is to get more input from the community. Let’s be fair, getting a JEP accepted is not something to be undertaken lightly, nor should it be. The work on JEP 285 started eighteen months ago and has required numerous changes to ensure that those in charge of the OpenJDK project are completely satisfied. We also needed to have a fully working prototype before we could even submit a JEP to prove that what we were proposing would work.

With millions of Java developers and thousands of enterprises big and small depending on Java, it’s vital that all changes are scrutinised carefully before being released into the wild.

The question to leave you with is: what feature are you going to add to Java?

© Azul Systems, Inc. 2016 All rights reserved.