Java 9 tutorial : New features introduced and discussed in detail - Must read


In this java tutorial we will learn new features which will be introduced in Java 9.
Java 9 will be introduced in July 2017.

JAVA 9 : New feature 1 >
Improvement in API’s for controlling and managing the OS processes in java 9
Improvement in API’s for controlling and managing the OS (operating system) processes.
Limitations of current API’s forces developers to turn to native code, i.e. developers has to depend more on platform specific code.

Currently Java SE provides only limited support for handling native OS processes.

Many huge applications like enterprise applications have multiple JVM’s and processes. So, they need to have the ability to
  • get the process id (PID) of current jvm and also the pid of processes which were created with the the existing API.
  • Mention the name, pid of all the processes running on the system.
  • Deal with the sub processes process .
  • Also deal with the process tree.

Read : Improvement in API for controlling and managing the OS processes in java 9



JAVA 9 : New feature 2 >
Improve the way JVM compiler is handled in java 9
Java 9 looks to improve the way JVM compiler is handled. Improve the performance of JVM compiler. With this change JVM compiler could be managed at runtime and also have method dependent compiler flags so that JVM compiler tests could be executed without any need of restarting the whole JVM. It will also add encapsulation (OOP principal) to compiler design.

Compiler directive >
Compiler directive is the set of all options required to control the JVM compilers.
Compiler directives contains instructions on how to compile.

How to load compiler directive file in java 9?
Compiler Directives files can be loaded from CMD (command line).

What will be format of compiler directives file?
Compiler directives file have human readable file format.
Compiler directives file format will be a subset of JSON with some minor additions.
So what will be difference between json and Compiler directives file format >
  • It will allow comments >   "//"
  • Extra trailing will be allowed in arrays and the objects > '',"
  • Escape characters are not likely to allowed.
  • Number types Supported > only int and double.

Compiler directives file can use all the UTF-8 characters as supported by the JVM specification.
Reserved characters for the Compiler directives file >
curly brace open > {
curly brace end > |
square brace open > [
square brace end > ]
quotes > "
colon > :
comma > ,


JAVA 9 : New feature 3 >
G1 as default Garbage Collector in java 9.
G1 will be introduced as default Garbage Collector in Java 9.

3.1. The G1 garbage collector features -
  • G1 garbage collector was introduced in Java 7
  • G1 garbage collector was designed to replace CMS garbage Collector.
  • G1 garbage collector is parallel and concurrent, and
  • G1 Garbage Collector (or Garbage First) limits GC pause times and maximizes throughput.


3.2. Vm (JVM) option for enabling G1 Garbage Collector (or Garbage First) in java >
-XX:+UseG1GC


3.3. G1(Garbage First) collector functioning >
CMS garbage collectors divides heap into three sections: young generation, old generation, and permanent generation of a fixed memory size.
All memory objects end up in one of these three sections.

The heap is split/partitioned into many fixed sized regions (eden, survivor, old generation regions), but there is not a fixed size for them. This provides greater flexibility in memory usage.


3.4. When to use G1 garbage collector >
G1 must be used when applications that require large heaps with limited GC latency.

3.5. When to switch from CMS (or old garbage collectors) to G1 garbage collector >
Applications using CMS garbage collector may switch to G1 when >
  • Full GC durations are too long or too frequent.




JAVA 9 : New feature 4 >
Image support for widely used TIFF format in java 9.
Image support for widely used TIFF format will also be added in Image I/O framework i.e. in javax.imageio in Java 9. Currently java supports only PNG and JPEG formats.




I will keep on updating this article further to add more new features of Java 9.

JAVA 9 : New feature 5 >

Improve Locking performance in java 9


JAVA 9 : New feature 6 >

JVM logging system in Java 9 - Levels, tags, output, rotation, decoration


JAVA 9 : New feature 7 >

varHandle (variable handle) in java 9


JAVA 9 : New feature 8 > Segmented Code Cache in java 9 - Non-method, Profiled code and non-profiled code


JAVA 9 : New feature 9 > Modular JDK in java 9


JAVA 9 : New feature 10 >Jigsaw Project in java 9


JAVA 9 : New feature 11 > Http2 in java 9


JAVA 9 : New feature 12 > Modular Source Code in java 9


JAVA 9 : New feature 13 > Remove Deprecation Warnings on Import Statements




Summary >
In this java tutorial we learned new features of Java 9.


Having any doubt? or you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.


RELATED LINKS>


Labels: Core Java Java 9
eEdit
Must read for you :