Java 10 Support at Jelastic PaaS: The Main Benefits and Smooth Project Migration to the Newest Engine

15

Recently Java development community was flustered with adoption of a new long-term Java development plan, announced by Oracle team. Its integration implies releasing a new JDK version each 6 months, with the major long-term supported (LTS) engine being provisioned once per 3 years. This way, on the morrow of the recent Java 9 implementation, the next Java SE Development Kit 10 (JDK 10) was introduced just about a few weeks ago.

Keeping in pace with the latest development tendencies and technologies, today we are glad to announce the implementation of the JDK 10 support for Tomcat 8/9, TomEE application servers and Maven build node within Jelastic PaaS (whilst the rest of Java-based stack templates are going to be upgraded in the nearest future).

Below, we’ll check the most notable innovations and changes the Java 10 has brought and will show how to migrate your application to the newest engine version (or, if being a new Jelastic user, to create your first environment based on JDK 10) within Jelastic PaaS.

The Main Java 10 Specifics

So, why has Java 10 become a matter of such a big hype? Below we’ll describe the most significant changes you should be aware of when making the decision to migrate to the currently newest engine version:

  • Local variable type inference – inner server variables (i.e., the ones used inside methods or code blocks) can be declared using the var keyword without direct specifying of their type – it will be identified automatically considering the context of variable usage. This allows reducing the amount of code needed to define the appropriate settings, especially in confines of complex list types;
  • Garbage Collector (GC) performance improvements – by default, every Java VM is provided with multiple embedded garbage collectors inside (each of which is designed to satisfy particular requirements), whilst the system automatically selects and enables the most appropriate. JDK 10 improves source-code isolation of different garbage collectors to provide clean GC interface and making it easier to add a new one. In addition, latency during the full GC calls of the default G1 garbage collector was reduced due to the implemented parallelism;
  • Common repository for all JDK components – multiple repo’s of JDK code base were gathered within a single repository to avoid problems with source-code management and streamline development;
  • Improved Docker awareness – if being run inside a Docker container, JVM will have an access to the container-specific information (for example, number of CPUs and total memory amount, allocated to a node) instead of querying operation system each time such data is required. Also, a few additional JVM options were added to give Docker container users better control of system memory.

The full release notes can be viewed at the official website. And below we’ll discover how to grab all of these benefits through migrating your application to Java 10.

Note: Most code and libraries should work on JDK 10 without any changes, but in case of using some third-party libraries, you need to ensure they were upgraded accordingly.

Getting Java 10 Environment

To run your Java application based on the JDK 10 in Jelastic, you can:

  • Create the appropriate new environment;
  • Redeploy the already existing server to switch the engine version.

Both of these processes are completely simple and straightforward to perform with convenient Jelastic UI.

Creating a New Environment

1. Log into your Jelastic account and click the New environment button in the upper left corner of the dashboard.

883-1-create-new-java-10-environment

2. Within the opened wizard, switch to the Java tab, select the desired application server (Tomcat 8, Tomcat 9 or TomEE in our case) and choose the JDK 10 tag within its central frame.

883-1-jdk-10-support-for-tomcat-8-tomcat-9-tomee

Look through the remaining wizard options (e.g., vertical and horizontal scaling limits, Public IP, etc.) and adjust them up to your needs. When ready, proceed with the Create button.

3. In just a minute your environment will be created.

883-1-java-10-support-within-jelastic-paas

That’s it! Your Java 10 environment is ready!

Updating Running Application Server

Note: If you have concerns about your application running properly on Java 10, it is recommended to test the upgrade process on the appropriate specially created environment clone first. Consequently, if everything is OK, you can perform the same changes on your production environment or just swap the incoming traffic to the configured copy.

1. Hover over the layer with Application Servers you’d like to upgrade and click on the Redeploy containers button.

883-1-updating-running-application-server-redeploy-containers

2. Within the opened frame you can choose a stack with another engine version by selecting the appropriate Tag from the list.

883-1-select-java-engine-version

Tip: Upon redeploying a horizontally scaled server (represented with an environment layer of multiple containers), you can avoid the implied application downtime by selecting the sequential deployment mode within the appropriate frame, so that the nodes will be updated one-by-one.

3. In several minutes, you’ll see the operation success notification.

883-1-jdk-10-project-enviroment-creation

Congratulations! Now your application is running in conjunction with Java 10!

To make sure of this and check the exact Java version your application server is run on, connect to it via SSH (e.g., using the embedded Web SSH client) and execute the following command:

java –version

883-1-java-version-check-via-ssh

Within the received response, you’ll see the currently used version of Java engine (circled in the image above). Now, you can proceed with your application deployment in any preferable way – from an archive file, remote GIT/SVN repository or by means of plugins (Ant Task, Eclipse, IDEA, Maven, NetBeans).

Try Java 10 completely for free by signing up for a trial period at our Jelastic PaaS platform. Meanwhile, stay tuned for integration of the next Java 11 LTS engine version in a half of a year (September, 2018) and its fast adoption within Jelastic PaaS.

Faced any issues with the Java 10 environment creation or the existing server upgrade? Contact Jelastic technical experts at Stackoverflow for assistance.