Home » Clear Your Concept » Java 11: A Brief Overview of Features and Enhancements » Java 11: A Brief Overview of Features and Enhancements- Part2

Java 11: A Brief Overview of Features and Enhancements- Part2

Last Updated on August 20, 2023 by KnownSense

On the previous page, we learned about checking out the changes to the methods that programmers use, and also some other helpful things that were added in java 11. Now, on this page, we’re going to keep going and find out more about the new stuff in java11. We’ll find out about some things that were added to make programs run faster, and also about some parts of java11 that are not used anymore or are being phased out. So, let’s keep going on this journey!

Dynamic Class-File Constants

It support a new constant-pool form named CONSTANT_Dynamic which allows constant values to be dynamically referenced in the constant pool of class files. In simpler terms, it lets you define constants in your Java code that are not directly embedded in the bytecode, but are instead referenced at runtime, offering more flexibility and efficiency in certain scenarios. This can be particularly useful for frameworks and libraries that generate bytecode dynamically or need to manipulate constant values without recompiling the entire codebase.

Improved Aarch64 Intrinsics

Java 11 has made the Aarch64 architecture intrinsics even better, allowing Java programs to take advantage of the unique features and optimizations that Aarch64 processors offer. Intrinsics are low-level operations that are directly supported by the hardware, allowing the JVM to generate optimized code for specific processor instructions. Java 11 optimizes the existing string and array intrinsics on ARM64 or AArch64 processors. Additionally, new intrinsics are implemented for sin, cos, and log methods of java.lang.Math. This can lead to faster and more efficient code execution on devices and servers that use these processors.

No-Op Garbage Collector

Java 11 introduced a No-Op (No Operation) Garbage Collector as experimental feature , also known as the Epsilon garbage collector. Unlike traditional garbage collectors, which manage memory and reclaim objects that are no longer needed, the Epsilon garbage collector does virtually nothing in terms of memory management. Its main purpose is to serve as a testing and profiling tool rather than a production-ready garbage collector.
In order to enable it, use the -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC flag.

Flight Recorder

Java Flight Recorder is a profiling and diagnostics tool that’s included in the Oracle HotSpot JVM (Java Virtual Machine). It allows developers and administrators to collect detailed runtime information about the behavior of a Java application, including CPU usage, memory allocation, garbage collection, thread activity, and more. In Java 11, Oracle made Java Flight Recorder (JFR) available for free in Oracle JDK distributions, even for production use, without the need for a separate commercial license. This was a notable change because prior to Java 11, JFR was a commercial feature and required a specific license. Java 11 brought several improvements in JFR which provides better insights into application performance, memory usage, and other runtime behaviors. JFR is designed to have low runtime overhead, allowing it to be used in production environments with minimal impact on application performance.

To start a 120 seconds JFR recording, we can use the following parameter:

-XX:StartFlightRecording=duration=120s,settings=profile,filename=java-demo-app.jfr

Removed and Deprecated Modules

Deprecated Modules:

  1. java.corba: The CORBA (Common Object Request Broker Architecture) module is marked as deprecated. CORBA support is being phased out, and it is recommended to migrate to other technologies for distributed applications.
  2. java.activation: The Activation module, used for handling MIME types and MIME data, is deprecated. Modern alternatives are recommended for MIME handling.
  3. java.se.ee: The java.se.ee aggregated module, which provided access to Java EE (Enterprise Edition) APIs, is deprecated. Java EE has evolved into Jakarta EE, and applications should transition to using Jakarta EE APIs.
  4. Nashorn JavaScript engine, including the JJS tool
  5. Pack200 compression scheme for JAR files

Removed Modules:

  1. java.xml.ws.annotation: This module contained the Java API for XML Web Services (JAX-WS) annotations. It has been removed, as JAX-WS is considered a legacy technology. Modern applications should use JAX-RS (Java API for RESTful Web Services) for web services.
  2. java.xml.bind: The Java Architecture for XML Binding (JAXB) module has been removed. JAXB is also considered a legacy technology, and developers are encouraged to use alternative libraries for XML binding.
  3. java.xml.ws: The Java API for XML Web Services (JAX-WS) module itself has been removed. JAX-WS is being phased out in favor of modern web service technologies.
  4. JDK Mission Control (JMC) is no longer included in the JDK. A standalone version of JMC is now available as a separate download.

Miscellaneous Changes

Java 11 brought some additional alterations that are worth noting:

  • Safer ChaCha20 and ChaCha20-Poly1305 encryption methods replace the less secure RC4 stream cipher.
  • Improved cryptographic key agreement using Curve25519 and Curve448 replace the current ECDH method.
  • Enhanced Transport Layer Security (TLS) to version 1.3 results in better security and performance enhancements.
  • Introduced a new garbage collector called ZGC, designed for low latency, as an experimental feature with minimal pause times.
  • Included support for Unicode 10, expanding the available characters, symbols, and emojis.

Conclusion

In this article, we looked into a few fresh aspects of Java 11.
We talked about the distinctions between Oracle and Open JDK. We also went through alterations in APIs, along with helpful tools for developers, improvements in performance, and modules that have been taken out or marked as deprecated.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top