Main content

Grinding Java 11 beans into production

Pierre-Yves Bigourdan and Sam Lukes

Software engineers, D+E Platform

Tagged with:

Pierre-Yves Bigourdan and Sam Lukes are two software engineers from D+E Platform Media Services, where they build highly available Java microservices in the cloud to enable the 成人论坛's Live streaming capability. They give a light-hearted account of their experiences with Java 11.

On September 26th, 2018, the sun was out for the last remnants of the late British summer. It also happened to be 成人论坛 Media Services team's monthly innovation day. "Hey Sam, let's try out Java 11..." were the fateful words which led us to push the latest version of OpenJDK into production. Java 11 is the designated long-term support version and had been made publicly available just the day before, therefore ending support for Java 10 which younger versions of ourselves had enthusiastically deployed only months before!

Getting the new version of the JDK set up on our laptops was no problem and after upgrading our respective Eclipse and IntelliJ installations to the latest beta versions, we were in business... Well, barring some intriguing :

Getting our project building with the newly installed compiler was more challenging than we first thought it would be, due to yet more exceptions:

java.lang.IllegalStateException: Could not find sun.misc.Unsafeorg.apache.maven.plugin.PluginExecutionException: Execution default-testCompile of goal ...

Some tips to get you going if your build blows up too:

  • If any of the libraries you use perform bytecode manipulation, pin their transitive dependencies such as or to their latest versions.
  • If you are using Maven as a build tool, update the Compiler and Surefire plugins.
  • Include any as dependencies to your project, for instance, java.xml.bind.
  • Migrate any code using removed methods or now encapsulated internal APIs. We're talking about you sun.misc.Unsafe.

"How do we actually install this on the server?" was our next troubling question. Unfortunately, this was not as simple as yum install openjdk-11 since no packages were provided at the time of writing. To solve this problem we had to create our own , the preferred way of installing software on our chosen Linux distribution. When built, our rpm downloads then unpacks the binary files from the OpenJDK website and when installed it registers the executables (java, jps and friends) as  Linux commands. We also had to do some extra work to make sure the cacerts truststore used by Java included all the certificates that we needed to be able to talk to our internal services and cloud providers.

We use as our continuous integration server and for each project we have a pipeline of jobs which build, test and deploy a release to the cloud. Getting Java 11 available for builds was as simple as installing our newly cooked rpm onto the build slaves and tweaking some global configuration so that Jenkins knew how to configure each job's environment.

However, this was not the end of the story as an uninvited guest showed up to the party, our code quality tool . Our build pipeline was blocked due to the fact that several of its plugins were not yet quite ready for the latest version of Java. After a few dependency tree tweaks, a submitted pull request and building from source, we had lift-off. Finally, one of our services was happily processing requests using Java 11 in our pre-production environments!

Whilst so far we are still experimenting with some of the more radical features of recent Java releases such as the modular system, we are already enjoying some of the API and syntax updates including:

  • a modern and flexible HttpClient
  • the polarising var keyword for local variable type inference
  • many richer API methods on collections, strings, optionals, streams...
  • and many more!

If you are wondering whether you should upgrade to Java 11 yet, then from our experience the answer is "yes" it's definitely possible and a microservices architecture which allows you to take one step at a time will certainly help. However, you might want to wait a few weeks for the open source Java ecosystem to catch up!

Tagged with:

More Posts

Previous

成人论坛 Music Memories

Next

IBC 2018: The little exhibition that forgot