Home > News content

Preview of new Java 10 features

via:博客园     time:2017/11/23 19:16:38     readed:830

English original:Java 10 - The Story So Far

It has been two months since the release of Java 9The latest release planIt's only four months away from the next Java release. The new features of Java 10 are still being confirmed, so it is possible to add major changes from now to the GA version. In any case, in these four months, developers can expect new features to be added to Java 10.

New features and enhancement are generally passedJava Enhancement Process(JEP) orJava Community ProcessStandard request (JSR) tracking. Because the timeline of Java 10 is short and the range is relatively small, the change of Java 10 will be tracked by JEP.

The features that are expected to be included in Java 10 are those that are already in Targeted or Proposed state, including JEP:

  • 286: inference of local variable types
  • 296: unified JDK warehouse
  • 304: garbage collector interface
  • Parallel Full GC of 307:G1
  • 310: application class data sharing
  • 312:ThreadLocal holding mobile phone system

JEP 296 is a pure cleanup, and JEP 304 strengthens code isolation for different garbage collector and introduces a simpler interface for garbage collector.

JEP 304 means that vendors can more freely choose a specific GC algorithm to build JDK, because there are a variety of GC in development, such asShenandoah,ZGCandEpsilonThese GC algorithms can be used in the future. Communities are working too hardDeprecated or even removed Concurrent Mark Sweep (CMS) garbage collectorBut there is no substitute available at the moment.

The more interesting changes might be JEP 286, and the enhanced native variable type inference can allow developers to save a lot of variables to declare template code. That is to say, in the next version, the following variable declaration is legal:

var list = new ArrayList

This syntax is limited to initialized local variables and local variables in the for loop.

It's actually a grammatical sugar, and it doesn't change in semantics. However, this feature may cause a heated discussion among Java developers.

The other three changes will have some impact on performance.

JEP 307 solves a problem of G1 garbage collector

JEP 310 extends the class data sharing (CDS). JVM can record some classes into a shared compressed file, which can be mapped to the JVM process at the next boot of JVM, so as to reduce the startup time. The file can also be shared between multiple JVM, running multiple JVM on the same machine, this can reduce memory footprint.

This function already exists in Java 5, but as of Java 9, this function only allows the bootstrap class loader to load the compressed class. The purpose of JEP 310 is to extend this functionality so that applications and custom class loaders can also load compressed classes. This feature is currently available only in Oracle JDK, and OpenJDK does not contain this feature.

JEP plans to migrate this feature from a Oracle private warehouse to a public warehouse. From Java 10, the regular version (non LTS) will use OpenJDK's binary package. This indicates that a user is using this feature, so it needs to be supported in OpenJDK.

JEP 312 aims to improve the performance of virtual machines, calling callbacks on application threads no longer need to perform global virtual machine security point operations, which means that JVM can stop a single thread. Some of the bottom improvements include:

  • Reduce the impact of stack trace sampling (such as profiling).
  • Reducing signal dependency to achieve better stack sampling.
  • Improved bias lock by stopping individual threads.
  • Removed some memory barriers from JVM.

On the whole, Java 10 does not seem to contain significant new features or performance improvements. This is understandable, after all, this is the first version of the new release cycle.

China IT News APP

Download China IT News APP

Please rate this news

The average score will be displayed after you score.

Post comment

Do not see clearly? Click for a new code.

User comments