The release of Java 10, mere six months after the release of Java 9 on September 21, 2017, attracted much speculation. This was significant as it brought to the forefront Oracle’s new release cycle. As per the new accelerated release cycle, every six months a new version of Java will be released. Moreover, Oracle is also poised to release an LTS version every 3 years, which is a kind of major Java release. The next release with LTS is Java 11 set to release on September 2018. What it means for the short versions, like Java 9 & Java 10 is pretty much obvious; it will become obsolete with no further free support available.
Having said all this, Java surely is one of the most popular programming language. Those who wants to pursue a career using Java can benefit greatly by enrolling in any of the java courses available today. Java training for certain is the best way to boost one’s career.
Now, let’s take a look into some of the key features of Java 10 that sets it apart from the previous versions of Java. Also, let’s have a brief look into how effective they are.
Local Variable Type Inference
The new keyword var enables developers to skip the ceremony associated with defining local variables, meaning that the type of the variable will be inferred from context. This feature was supposed to come in Java 9, but was dropped later. For instance, var will allow the developers to declare var n = ‘String’ instead of String n = ‘String’. This will save the verbosity associated with java and also increase the readability of the code. Before var, developers used to spend double the time to accomplish things in Java as compared to the other programming languages like Python, Groovy and JavaScript.
Though the introduction of this new feature has certainly excited java enthusiasts, it hasn’t made much difference for developers/ programmers using other programming languages such as Kotlin, Scala, Go, C# as they already have a kind of built- in local variable type inference.
For example, Kotlin and Scala have the keywords var and val; C# has var; C++ has auto; JavaScript has let and Go has support through declaration with the operator :=
Parallel Full GC for G1
G1 Garbage collector which was made default in Java 9 , disregards full garbage collection and the users experience is affected when concurrent threads for memory is not able to revive the memory fast. Java 10 improves on the worst case latencies in g1 by making the GC full parallel. The mark sweep compact algorithm of G1 collector is parallelized as a part of this and will be invoked in case of any discrepancies.
Garbage-Collector Interface
Java 10 improves the code isolation of the different garbage collectors via the introduction of a common Garbage Collector Interface. This brings many benefits including easy addition of new GC without requiring any change in existing code base, better modularity of internal GC code and housekeeping the previous GC.
Experimental Java-Based JIT Compiler
This feature allows the users to use Graal, a Java based JIT compiler. It can be employed as an experimental compiler on the Linux arena. Introduced first in Java 9 as an alternative to the JIT compiler, Graal is a kind of futuristic inclusion in Java 10. Programmers/Developers who wants to switch to Graal can do it with the following code:
-XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
Thread-Local Handshakes
This JEP which can be directly used by the developer enhances performance. A handshake tool is an improvement of the Hotspots safepoints mechanism. With this feature, Java 10 introduces a new way to carry out a call back on threads. This feature will make it cheap and possible to curb individual threads, thus helping to advance from the option of either stopping all threads or none.
Heap Allocation on Alternative Memory Devices
This feature enables the HotSpot VM to assign java object heap on a substitute memory according to user’s instruction. For instance, it would make it possible to allocate lower priority processes to utilize the memory of NV- DIMM in a multi- JVM environment.
Consolidate the JDK Forest into One Single Repository
This new feature will combine the various repositories of the JDK into one. It will also carry out some housekeeping tasks. Conclusion
Without any doubt, Java is advancing faster with its new release cycle. But the question is at what price? The new release cadre has put the spotlight on the developers and package maintainers, who has to now shoulder the responsibility of the keeping applications updated. It can also be seen as an aggressive move to push more users to paid support.
One thing that is becoming clear is that most developers will treat Java 9 & 10 as software for experimentation rather than production because of its short support life which in turn render the new release cycle less effective.