JDK17 Support in Payara Community

Photo of Rudy De Busscher by Rudy De Busscher

JDK 17 is the latest Long Term Supported (LTS) version of the Java platform, released in September 2021. LTS versions will have regular releases for the coming years and you don't need to switch to a newer version after 6 months as you do with those 'interim' JDK versions.

The features in an LTS version are kept stable so it is ideal for running  your enterprise applications. Once you switch to an LTS, you can safely update to any minor release to accommodate for security issues and bug fixes of the JDK platform, but without needing to perform a migration.

With the release of the November 2021 version of the Payara Platform Community Edition, Payara Server, Payara Micro, and the Web Profile run on JDK 17 platform.

JDK 17 Support

The changes between JDK 11 and JDK 17 are much smaller than changes we saw between JDK 8 and JDK 11. Smaller changes means we had to do only little changes to our Payara Platform codebase to make it run on JDK 17.

From a platform developer's point of view, most of our changes are related to the further encapsulation of the JVM parts that are now considered internal. Since the modular approach was introduced in JDK 9, there is a continuous effort to shield some parts of the JVM. This means that we had to rewrite some parts of our code, and in some cases, open some packages for access. We also updated the libraries we use to the latest version to have full compatibility with the latest Java version.

As a result, the Payara Platform Community Edition 5.2021.9 of Payara Server and Payara Micro runs JDK 17 and all features should work on this LTS version. If you are interested in running your applications on JDK 17, we encourage you to give them a try in your development and testing environment. If you have any questions or encounter any issues you can reach us on the Payara Forum and the Github Issue Tracker.

In the meantime, we are performing more tests and using the platform in many scenarios on the JDK 17 binaries so we can guarantee the stability before providing JDK 17 support in the Payara Enterprise Edition.

Why Should I Change to JDK 17?

There are many aspects within JDK 17 that are appealing for a Jakarta Developer.  First of all, there are many language changes and additions to make it easier.

This is a brief summary of what we find interesting and you can find various sources on the internet that describe how to use them:

  • The Switch expression
  • the mapMulti method addition for Streams
  • Text Blocks to define multi-line Strings
  • Pattern matching for instanceof and switch
  • The Record structure

Although the usage of the Record structure is not defined in the Jakarta JSON Binding specification, you can already make use of it within a Jakarta runtime.  You can define the properties of the structure using the 'getter' notation as in the next example.

public record CountryDTO(String getName, String getContinentName) { 
// We need to use getxxx because the JSONB spec defines only 'getters' should be considered
// Spec needs to be updated for Records. }

 

You can also define an Adapter or a custom Serializer to solve the handling of Record without the need for the hack using the name of the properties.

You can learn more about using JDK 17 and Jakarta during my presentation at JakartaOne LiveStream at the beginning of December.

But besides the new language constructs, there are operational aspects that make JDK 17 a very interesting choice.

The new set of Garbage collectors have a minimal impact on the performance of the application itself. The Z garbage collector and the Shenandoah garbage collector are concurrent processes and only halt the application threads for a very limited amount of time. This results in a higher throughput of user requests. But also the G1 collector is improved in the latest versions and will result in better performance for your application.

The usage of the Class Data Sharing feature is simplified. The Archive file can now be created when the JVM exists without the need for an additional step just as the Open J9 implementation provided already for a long time. Realizing an improvement of 35% of the application startup time is now easier than ever. And can be done without rewriting your application to have support for native compilation that requires a lot of effort.

Other new features include the support for AArch64 processor architecture, using the Flight Recorder for monitoring purposes (not only for diagnostics) and the new Packaging tool can be handy in case you need to package a client program for installation.

Also, some important security-related changes are done. Some of the algorithms are removed, and new ones are created. But the most important one is probably the addition of Serialization filters so that you can block unwanted classes when you deserialize data.

Try JDK 17 and Give Us Feedback

Payara Platform Community 5.2021.9 can be used on JDK 17 and we encourage you to try it out in your development or test environment if you want to make use of the new features and functionalities of this version. You can always give us feedback on the Payara Forum or the Github Issue page while we perform more extended tests and prepare it for inclusion into the Payara Enterprise Edition.

 

 Payara Platform  Download Here 

 

Comments