@martin_fmi
JDK 10 sneak peek
Martin Toshev
Martin Toshev
@martin_fmi
Who am I
Software consultant (CoffeeCupConsulting)
BG JUG board member (http://jug.bg)
OpenJDK and Oracle RBDMS enthusiast
Twitter: @martin_fmi
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
Agenda
Release overview
Feature highlights
What’s next ?
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
Release overview
@martin_fmi
JDK 10
•First 6-month cadence release
•An STS (short-term release): end of support in September
•Class File Version Number: 54.0
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
JDK 10
• Highlight of the release is the introduction of the var keyword
• A lot of focus put on internal performance and code improvements
• Not so many new features
• Still weak adoption from community (along with JDK 9) at present
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
Implemented JEPs
•286: Local-Variable Type Inference
•296: Consolidate the JDK Forest
into a Single Repository
•304: Garbage-Collector Interface
•307: Parallel Full GC for G1
•310: Application Class-Data Sharing
•312: Thread-Local Handshakes
Martin Toshev Prague, 19-20 October 2017
• 313: Remove the Native-Header
Generation Tool (javah)
• 314: Additional Unicode
Language-Tag Extensions
• 316: Heap Allocation
on Alternative Memory Devices
• 317: Experimental Java-Based JIT Compiler
• 319: Root Certificates
• 322: Time-Based Release Versioning
@martin_fmi
Other enhancements
Martin Toshev Prague, 19-20 October 2017
•Docker container awareness
•Collections API improvements
•Optional API improvement ( orElseThrow() )
•Removed and deprecated APIs
•Less significant enhancements (such as faster JShell startup and others)
@martin_fmi
Feature highlights
@martin_fmi
JEP 286: Local-Variable Type Inference
•var keyword introduced in the Java language
•allows developers to reduce the amount of boilerplate code they write
Martin Toshev Prague, 19-20 October 2017
List<String> entities = new LinkedList<String>();
var entities = new LinkedList<String>();
@martin_fmi
JEP 310: Application Class-Data Sharing
•Provides a mechanism to reduce memory footprint of class metadata
across JVM processes
•Provides a mechanism to reduce application startup time
•At present supports only classes bundled in JAR files
•Based on the CDS feature introduced in JDK 5 (which works only with the
bootstrap class loader)
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
JEP 310: Application Class-Data Sharing
1.Determine application classes for AppCDS archive:
Martin Toshev Prague, 19-20 October 2017
java -XX:+UnlockCommercialFeatures -Xshare:off -XX:+UseAppCDS
-XX:DumpLoadedClassList=application.lst -cp application.jar Main
@martin_fmi
JEP 310: Application Class-Data Sharing
2. Generate the AppCDS archive:
Martin Toshev Prague, 19-20 October 2017
java -XX:+UnlockCommercialFeatures -Xshare:dump -XX:+UseAppCDS
-XX:SharedClassListFile=application.lst
-XX:SharedArchiveFile=application.jsa
@martin_fmi
JEP 310: Application Class-Data Sharing
3. Run the application with the AppCDS archive:
Martin Toshev Prague, 19-20 October 2017
java -XX:+UnlockCommercialFeatures -Xshare:on -XX:+UseAppCDS
-XX:SharedArchiveFile=application.jsa -cp application.jar Main
@martin_fmi
JEP 317: Experimental Java-Based JIT Compiler
•Enables Graal as an experimental JIT compiler on the Linux/x64 platform
Martin Toshev Prague, 19-20 October 2017
-XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
@martin_fmi
Internal performance improvements
•JEP 307: Parallel Full GC for G1
- full GC made parallel
•JEP 312: Thread-Local Handshakes
- optimization techniques allowing to stop individual threads
- enabled by default
- can be disabled:
Martin Toshev Prague, 19-20 October 2017
-XX:ParallelGCThreads=<count>
-XX:ThreadLocalHandshakes=false
@martin_fmi
Internal code restructuring
•JEP 296: Consolidate the JDK Forest into a Single Repository
- previously there were child repositories (langtools, jaxp etc.)
- these are now consolidated as part of the root repository
•JEP 304: Garbage-Collector Interface
- changed source structure to allow for easier addition of new GCs
- previous structure didn’t sandbox GCs enough
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
JEP 319: Root Certificates
•cacerts file now contains a default set of Cas
•they are part of Oracle’s Java SE Root CA program
Martin Toshev Prague, 19-20 October 2017
keytool -list -v -keystore %JAVA_HOME%jre_10.0.1libsecuritycacerts
@martin_fmi
JEP 313: Remove the Native-Header
Generation Tool (javah)
•The javah tool removed from JDK distribution
•javah functionality replaced by enhancements to javac
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
JEP 314: Additional Unicode
Language-Tag Extensions
•Java.util.Locale and other APIs (such as java.text.DateFormat) support the
following language-tag extensions:
• cu (currency type)
• fw (first day of week)
• rg (region override)
• tz (time zone)
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
JEP 316: Heap Allocation
on Alternative Memory Devices
•Provides the ability to allocate heap space on alternative memory devices
Martin Toshev Prague, 19-20 October 2017
-
XX:AllocateHeapAt=<path>
@martin_fmi
JEP 322: Time-Based Release Versioning
•Required due to the 6-month release cadence
•Runtime.Version API enhanced with new methods
•Two new system properties added:
o java.version.date
o java.vendor.version
•Java launcher enhanced to display additional version information
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
Docker container awareness
•The JVM is modified to support Docker container awareness
•Proper information (CPU/memory) retrieved from the container rather than
the OS
Martin Toshev Prague, 19-20 October 2017
-XX:-UseContainerSupport
@martin_fmi
Docker container awareness
•More options introduced in that regard:
Martin Toshev Prague, 19-20 October 2017
-XX:ActiveProcessorCount=<count>
-XX:InitialRAMPercentage=<percentage>
-XX:MaxRAMPercentage=<percentage>
-XX:MinRAMPercentage=<percentage>
@martin_fmi
Optional API
•A new method introduced: orElseThrow()
•A better alternative of get()
Martin Toshev Prague, 19-20 October 2017
Optional x = Optional.ofNullable(null);
x.orElseThrow( () -> {
return new RuntimeException("Optional value is null");});
@martin_fmi
Collections API
• New collection API methods that allow the creation of unmodifiable
collections:
Martin Toshev Prague, 19-20 October 2017
List<String> entitiesListCopy = List.copyOf(entitiesList);
Set<String> entitiesSetCopy = Set.copyOf(entitiesSet);
Map<String, String> entitiesMapCopy = Map.copyOf(entitiesMap);
entitiesList.stream().collect(Collectors.toUnmodifiableList());
entitiesSet.stream().collect(Collectors.toUnmodifiableSet());
entitiesMap.entrySet().stream().collect(
Collectors.toUnmodifiableMap(e -> e.getKey(), e -> e.getValue()));
@martin_fmi
What’s next ?
@martin_fmi
JDK 11
• Target proposals:
o 309: Dynamic Class-File Constants 
o 318: Epsilon: A No-Op Garbage Collector 
o 320: Remove the Java EE and CORBA Modules 
o 321: HTTP Client (Standard) 
o 323: Local-Variable Syntax for Lambda Parameters 
o 324: Key Agreement with Curve25519 and Curve448 
o 327: Unicode 10 
o 328: Flight Recorder 
o 329: ChaCha20 and Poly1305 Cryptographic Algorithms 
o 330: Launch Single-File Source-Code Programs 
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
JDK <N>
• Project Panama
• Project Valhalla
• Project Loom
• GraalVM/Truffle
• Project Metropolis
• More to come …
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
Summary
• JDK 10 is a milestone for new release cadence of the JDK
• Major highlights: var keyword, AppCDS, Graal JIT experimental support
• Provides performance improvements
• Provides container awareness for JVM applications
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
References
JDK 10 enhancement proposals
http://openjdk.java.net/projects/jdk/10/
JDK 10 release notes
http://openjdk.java.net/projects/jdk/10/
Martin Toshev Prague, 19-20 October 2017
@martin_fmi
References
JDK 10 Whitepaper
https://developer.oracle.com/devo/res/pdf/1385446602743/Oracle-
Java10.pdf
Java SE 10 final release specification
http://cr.openjdk.java.net/~iris/se/10/latestSpec/
Martin Toshev Prague, 19-20 October 2017

Jdk 10 sneak peek

  • 1.
    @martin_fmi JDK 10 sneakpeek Martin Toshev Martin Toshev
  • 2.
    @martin_fmi Who am I Softwareconsultant (CoffeeCupConsulting) BG JUG board member (http://jug.bg) OpenJDK and Oracle RBDMS enthusiast Twitter: @martin_fmi Martin Toshev Prague, 19-20 October 2017
  • 3.
    @martin_fmi Agenda Release overview Feature highlights What’snext ? Martin Toshev Prague, 19-20 October 2017
  • 4.
  • 5.
    @martin_fmi JDK 10 •First 6-monthcadence release •An STS (short-term release): end of support in September •Class File Version Number: 54.0 Martin Toshev Prague, 19-20 October 2017
  • 6.
    @martin_fmi JDK 10 • Highlightof the release is the introduction of the var keyword • A lot of focus put on internal performance and code improvements • Not so many new features • Still weak adoption from community (along with JDK 9) at present Martin Toshev Prague, 19-20 October 2017
  • 7.
    @martin_fmi Implemented JEPs •286: Local-Variable TypeInference •296: Consolidate the JDK Forest into a Single Repository •304: Garbage-Collector Interface •307: Parallel Full GC for G1 •310: Application Class-Data Sharing •312: Thread-Local Handshakes Martin Toshev Prague, 19-20 October 2017 • 313: Remove the Native-Header Generation Tool (javah) • 314: Additional Unicode Language-Tag Extensions • 316: Heap Allocation on Alternative Memory Devices • 317: Experimental Java-Based JIT Compiler • 319: Root Certificates • 322: Time-Based Release Versioning
  • 8.
    @martin_fmi Other enhancements Martin ToshevPrague, 19-20 October 2017 •Docker container awareness •Collections API improvements •Optional API improvement ( orElseThrow() ) •Removed and deprecated APIs •Less significant enhancements (such as faster JShell startup and others)
  • 9.
  • 10.
    @martin_fmi JEP 286: Local-Variable TypeInference •var keyword introduced in the Java language •allows developers to reduce the amount of boilerplate code they write Martin Toshev Prague, 19-20 October 2017 List<String> entities = new LinkedList<String>(); var entities = new LinkedList<String>();
  • 11.
    @martin_fmi JEP 310: Application Class-DataSharing •Provides a mechanism to reduce memory footprint of class metadata across JVM processes •Provides a mechanism to reduce application startup time •At present supports only classes bundled in JAR files •Based on the CDS feature introduced in JDK 5 (which works only with the bootstrap class loader) Martin Toshev Prague, 19-20 October 2017
  • 12.
    @martin_fmi JEP 310: Application Class-DataSharing 1.Determine application classes for AppCDS archive: Martin Toshev Prague, 19-20 October 2017 java -XX:+UnlockCommercialFeatures -Xshare:off -XX:+UseAppCDS -XX:DumpLoadedClassList=application.lst -cp application.jar Main
  • 13.
    @martin_fmi JEP 310: Application Class-DataSharing 2. Generate the AppCDS archive: Martin Toshev Prague, 19-20 October 2017 java -XX:+UnlockCommercialFeatures -Xshare:dump -XX:+UseAppCDS -XX:SharedClassListFile=application.lst -XX:SharedArchiveFile=application.jsa
  • 14.
    @martin_fmi JEP 310: Application Class-DataSharing 3. Run the application with the AppCDS archive: Martin Toshev Prague, 19-20 October 2017 java -XX:+UnlockCommercialFeatures -Xshare:on -XX:+UseAppCDS -XX:SharedArchiveFile=application.jsa -cp application.jar Main
  • 15.
    @martin_fmi JEP 317: Experimental Java-BasedJIT Compiler •Enables Graal as an experimental JIT compiler on the Linux/x64 platform Martin Toshev Prague, 19-20 October 2017 -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
  • 16.
    @martin_fmi Internal performance improvements •JEP307: Parallel Full GC for G1 - full GC made parallel •JEP 312: Thread-Local Handshakes - optimization techniques allowing to stop individual threads - enabled by default - can be disabled: Martin Toshev Prague, 19-20 October 2017 -XX:ParallelGCThreads=<count> -XX:ThreadLocalHandshakes=false
  • 17.
    @martin_fmi Internal code restructuring •JEP296: Consolidate the JDK Forest into a Single Repository - previously there were child repositories (langtools, jaxp etc.) - these are now consolidated as part of the root repository •JEP 304: Garbage-Collector Interface - changed source structure to allow for easier addition of new GCs - previous structure didn’t sandbox GCs enough Martin Toshev Prague, 19-20 October 2017
  • 18.
    @martin_fmi JEP 319: Root Certificates •cacertsfile now contains a default set of Cas •they are part of Oracle’s Java SE Root CA program Martin Toshev Prague, 19-20 October 2017 keytool -list -v -keystore %JAVA_HOME%jre_10.0.1libsecuritycacerts
  • 19.
    @martin_fmi JEP 313: Remove theNative-Header Generation Tool (javah) •The javah tool removed from JDK distribution •javah functionality replaced by enhancements to javac Martin Toshev Prague, 19-20 October 2017
  • 20.
    @martin_fmi JEP 314: Additional Unicode Language-TagExtensions •Java.util.Locale and other APIs (such as java.text.DateFormat) support the following language-tag extensions: • cu (currency type) • fw (first day of week) • rg (region override) • tz (time zone) Martin Toshev Prague, 19-20 October 2017
  • 21.
    @martin_fmi JEP 316: Heap Allocation onAlternative Memory Devices •Provides the ability to allocate heap space on alternative memory devices Martin Toshev Prague, 19-20 October 2017 - XX:AllocateHeapAt=<path>
  • 22.
    @martin_fmi JEP 322: Time-Based ReleaseVersioning •Required due to the 6-month release cadence •Runtime.Version API enhanced with new methods •Two new system properties added: o java.version.date o java.vendor.version •Java launcher enhanced to display additional version information Martin Toshev Prague, 19-20 October 2017
  • 23.
    @martin_fmi Docker container awareness •TheJVM is modified to support Docker container awareness •Proper information (CPU/memory) retrieved from the container rather than the OS Martin Toshev Prague, 19-20 October 2017 -XX:-UseContainerSupport
  • 24.
    @martin_fmi Docker container awareness •Moreoptions introduced in that regard: Martin Toshev Prague, 19-20 October 2017 -XX:ActiveProcessorCount=<count> -XX:InitialRAMPercentage=<percentage> -XX:MaxRAMPercentage=<percentage> -XX:MinRAMPercentage=<percentage>
  • 25.
    @martin_fmi Optional API •A newmethod introduced: orElseThrow() •A better alternative of get() Martin Toshev Prague, 19-20 October 2017 Optional x = Optional.ofNullable(null); x.orElseThrow( () -> { return new RuntimeException("Optional value is null");});
  • 26.
    @martin_fmi Collections API • Newcollection API methods that allow the creation of unmodifiable collections: Martin Toshev Prague, 19-20 October 2017 List<String> entitiesListCopy = List.copyOf(entitiesList); Set<String> entitiesSetCopy = Set.copyOf(entitiesSet); Map<String, String> entitiesMapCopy = Map.copyOf(entitiesMap); entitiesList.stream().collect(Collectors.toUnmodifiableList()); entitiesSet.stream().collect(Collectors.toUnmodifiableSet()); entitiesMap.entrySet().stream().collect( Collectors.toUnmodifiableMap(e -> e.getKey(), e -> e.getValue()));
  • 27.
  • 28.
    @martin_fmi JDK 11 • Targetproposals: o 309: Dynamic Class-File Constants  o 318: Epsilon: A No-Op Garbage Collector  o 320: Remove the Java EE and CORBA Modules  o 321: HTTP Client (Standard)  o 323: Local-Variable Syntax for Lambda Parameters  o 324: Key Agreement with Curve25519 and Curve448  o 327: Unicode 10  o 328: Flight Recorder  o 329: ChaCha20 and Poly1305 Cryptographic Algorithms  o 330: Launch Single-File Source-Code Programs  Martin Toshev Prague, 19-20 October 2017
  • 29.
    @martin_fmi JDK <N> • ProjectPanama • Project Valhalla • Project Loom • GraalVM/Truffle • Project Metropolis • More to come … Martin Toshev Prague, 19-20 October 2017
  • 30.
    @martin_fmi Summary • JDK 10is a milestone for new release cadence of the JDK • Major highlights: var keyword, AppCDS, Graal JIT experimental support • Provides performance improvements • Provides container awareness for JVM applications Martin Toshev Prague, 19-20 October 2017
  • 31.
    @martin_fmi References JDK 10 enhancementproposals http://openjdk.java.net/projects/jdk/10/ JDK 10 release notes http://openjdk.java.net/projects/jdk/10/ Martin Toshev Prague, 19-20 October 2017
  • 32.
    @martin_fmi References JDK 10 Whitepaper https://developer.oracle.com/devo/res/pdf/1385446602743/Oracle- Java10.pdf JavaSE 10 final release specification http://cr.openjdk.java.net/~iris/se/10/latestSpec/ Martin Toshev Prague, 19-20 October 2017

Editor's Notes

  • #6 TLS being the predecessor of SSL is not interoperable with SSL …
  • #7 TLS being the predecessor of SSL is not interoperable with SSL …
  • #8 TLS being the predecessor of SSL is not interoperable with SSL …
  • #9 TLS being the predecessor of SSL is not interoperable with SSL …
  • #11 TLS being the predecessor of SSL is not interoperable with SSL …
  • #12 TLS being the predecessor of SSL is not interoperable with SSL …
  • #13 TLS being the predecessor of SSL is not interoperable with SSL …
  • #14 TLS being the predecessor of SSL is not interoperable with SSL …
  • #15 TLS being the predecessor of SSL is not interoperable with SSL …
  • #16 TLS being the predecessor of SSL is not interoperable with SSL …
  • #17 TLS being the predecessor of SSL is not interoperable with SSL …
  • #18 TLS being the predecessor of SSL is not interoperable with SSL …
  • #19 TLS being the predecessor of SSL is not interoperable with SSL …
  • #20 TLS being the predecessor of SSL is not interoperable with SSL …
  • #21 TLS being the predecessor of SSL is not interoperable with SSL …
  • #22 TLS being the predecessor of SSL is not interoperable with SSL …
  • #23 TLS being the predecessor of SSL is not interoperable with SSL …
  • #24 TLS being the predecessor of SSL is not interoperable with SSL …
  • #25 TLS being the predecessor of SSL is not interoperable with SSL …
  • #26 TLS being the predecessor of SSL is not interoperable with SSL …
  • #27 TLS being the predecessor of SSL is not interoperable with SSL …
  • #29 TLS being the predecessor of SSL is not interoperable with SSL …
  • #30 TLS being the predecessor of SSL is not interoperable with SSL …