New Features in Java 9
The Java Programming Language is one of the most popular programming languages the world over. It is widely used in enterprise software development and has matured a lot over the last decade. The newest version of the Java SDK is Java 9 and is expected to be released in early 2016 under the name of Java Development Kit 9. This version would include enhancements in application performance, new capabilities, and support for enhanced modularity.
In this article, we would explore these new features in the Java 9 SDK. The list of new features in Java 9 is not much exhaustive, though. However, there's still a long time (almost two years) before the release of Java 9. So, we can expect many more additional features to be included over time.
So, what's new?
There are new features in Java 9 SDK aplenty. Some of these new features in the Java 9 SDK include the following:
- Support for a light-weight JSON API
- Support for a HTTP 2 client
- Support for modularization of source code
- Support for improvements in the Process API
- Support for smart compilation
- Support for Segmented Code Cache
- Improved performance in multi-threading
Light-weight JSON API
The light-weight JSON API would be delivered in Java 9 SDK through the java.util package. This provides a light-weight API for parsing, generation, and consumption of JSON data.
Segmented Code Cache
Segmented code cache is a new feature introduced in Java 9 SDK that divides the code cache into segments; this improves performance to a considerable extent. With Java 9, you have multiple distinct code heaps instead of a single code heap. Note that each of these code heaps in Java 9 contains compiled code of a particular type, thus improving performance. The runtime divides the code cache based on the following assumptions:
- Code that is ever lasting; in other words, one that would be in the cache forever
- Code for a comparatively short lifetime
- Code that has a potentially long lifetime
HTTP 2 Client
The Hyper Text Transfer Protocol (HTTP) is an industry standard and has been in use for a long time. HTTP 2 would be released sometime around the release of Java 9. HTTP 2 promises improved page load time and API capabilities. The new HTTP Client API would replace the legacy HttpURLConnection that implements HTTP 2.0 and web sockets. Existing API is outdated, hard to use, and difficult to maintain. This is expected to provide rich options with ease of use.
Modularization of Source Code
Support for the modularization of source code has been introduced in Java 9. This feature enables you to reorganize the source code into modules so that it can be scaled down seamlessly for small devices as and when needed; this promotes better performance, security, and maintainability of your source code.
The Java 9 SDK includes an improved version of the Smart Java Compilation tool called sjavac; this facilitates improved JDK build speeds because this compiler would take advantage of all the cores in your system. The sjavac tool provides a wrapper around javac and provides support for incremental and parallel compilation.
Process API Improvements
The Process API in Java 9 SDK has been updated to manage and control the processes of the OS efficiently. This new API provides features such as the ability to retrieve pid of JVM, enumerate JVM and processes, and so forth.
In this article, we discussed the new features in Java 9. The Java 9 SDK aims to provide an open source implementation of the Java SE 9 Platform. One of the most important features in Java 9 is to break the Java Runtime Environment (JRE) into a collection of interoperable components. Segmented Code Cache improves compilation performance with short sweep times. It does this by dividing the code cache into segments. We have explored these and other new and exciting features in Java 9 SDK. Happy reading!