+ All Categories
Transcript
Page 1: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

© Copyright Azul Systems 2015

@speakjava azul.com

JDK 9, 10, 11 and Beyond: Delivering New Features in the JDK

Simon Ritter Deputy CTO, Azul Systems

1

Page 2: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 9: Big And Small Changes

2

Page 3: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Java Platform Module System (JPMS) §  The core Java libraries are now a set of modules (JEP 220)

– 75 OpenJDK modules: 27 Java SE, 48 JDK – Oracle JDK: 14 additional JDK, 8 JavaFX, 2 Oracle specific

§  Most internal APIs now encapsulated (JEP 260) – sun.misc.Unsafe– Some can be used with command line options

3

Page 4: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

jlink: The Java Linker (JEP 282)

4

Modular run-time image

… conf bin

jlink

$jlink--modulepath$JDKMODS\--addmodsjava.base–outputmyimage$myimage/bin/java–-list-modulesjava.base@9

lib

Page 5: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

jlink: The Java Linker (JEP 282)

$jlink--module-path$JDKMODS:$MYMODS\--addmodscom.azul.zapp–-outputmyimage$myimage/bin/java–[email protected]@[email protected]@[email protected]@[email protected]

Page 6: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Moving Java Forward Faster

Page 7: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Java Platform Development §  Development of releases takes time

– JDK 6: 2 years and 2 months after JDK 5 – JDK 7: 4 years and 8 months after JDK 6 – JDK 8: 2 years and 8 months after JDK 7 – JDK 9: 3 years and 6 months after JDK 8

7

Page 8: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Migrating To A New Version §  Plenty of time to continue with previous release

– JDK 6: 2 years and 11 months of public JDK 5 updates – JDK 7: 1 year and 9 months of public JDK 6 updates – JDK 8: 1 year and 1 month of public JDK 7 updates

§  Also allows for stabilisation of new platform before migrating applications in production

8

Page 9: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

The Java Platform Today

9

Stable

Secure

Free

Page 10: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

OpenJDK: New Release Model §  A new version of the JDK will be released every six months

– March and September – Started this year with JDK 10 and JDK 11

§  OpenJDK development will be more agile – Previous target was a release every two years

§  Features will be included only when ready – Targeted for a release when feature complete

10

Page 11: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Long Term Support Releases §  Long term support for all releases is not practical

– One Long Term Support (LTS) release every three years §  JDK 8 has been classified as an LTS release

§ JDK 8 public updates stop in January 2019 for commercial users § Non-commercial users get updates until December 2020

§  Next LTS release is JDK 11 § JDK 9 and JDK 10 are feature releases § Updates for only six months

11

Page 12: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Which JDK Binary §  Traditional Oracle branded binary (java.oracle.com)

– Oracle Binary Code License (FoU restrictions) §  New OpenJDK binary (jdk.java.net)

– GPLv2 with CPE license (no restrictions) – Security and bug fix updates only for six months

§ Only until next JDK release § Two scheduled updates

– No overlap of updates for previous version

12

Page 13: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Converged Binaries

Oracle JDK

OpenJDK

Java SE

JDK 10 and earlier

Java SE

OpenJDK & Oracle JDK

JDK 11 and later

Page 14: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Converged Binaries (JDK 11) §  Some closed-source parts of the JDK will be open-sourced

– Flight recorder – Mission control ✔ – Others ✔

§  Other closed-source parts will be removed – Browser Plugin – Java Web Start – JavaFX

14

Page 15: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 9 Onwards And Compatibility

15

"Clean applications that just depend on java.se should just work" - Oracle

Page 16: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 9: The Clean Up Starts §  JDK 9 was a significant change for Java

– Deprecated APIs were removed for the first time § Six methods and one class § JDK 10 removed 1 package, 6 classes, 9 methods and 1 field

– Redundant features eliminated §  jhat tool, JVM TI hprof agent § Numerous deprecated GC options removed

– Significant command line changes § JDK 9 removed 187 -XX flags § JDK 10 removed 36 -XX flags

16

Page 17: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Housekeeping Will Continue §  More significant removals in JDK 11

– Applets, Browser Plugin, Web Start, JavaFX – java.se.ee meta-module

§ java.corba§ java.transaction§ java.activation§ java.xml.bind§ java.xml.ws§ java.xml.ws.annotation

§  More in the future – Nashorn deprecated, CMS garbage collector?

17

Page 18: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Compatibility Not Guaranteed §  New versions of Java may include breaking changes

– Anything for removal will be deprecated first – Minimum of one release warning

§ Could be only six months

18

Page 19: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Eliminating Confusion §  There will be an LTS release every three years

– This does NOT mean 3 years of free updates §  Oracle JDK (from JDK 11) can ONLY be used in production

with a commercial support contract – The only free JDK 11 and later will be OpenJDK binaries

§  To continue to receive free updates to the JDK you MUST update your JDK EVERY SIX MONTHS

§  JDK 8 can be used indefinitely for free – But without any further security patches and bug fixes

19

Page 20: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

New JDK Update Schedule

Page 21: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

The Java Platform Soon

21

Stable

Secure

Free

Choose two out of three

Page 22: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 10

Page 23: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Local Variable Type Inference §  JEP 286

– Simple use cases

– Style guidelines available – Good (appropriate use of variable name)

– Poor

§  Infered type is PriorityQueue<Object>

23

varlist=newArrayList<String>();//infersArrayList<String>varstream=list.stream();//infersStream<String>

varstringList=List.of("a","b","c");

varitemQueue=newPriorityQueue<>();

Page 24: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 10: JEPs §  JEP 307: Parallel Full GC for G1

– Still a full GC with potentially big pauses §  JEP 310: Application Class-Data Sharing

– Previous commercial Oracle feature §  JEP 317: Experimental Java-based JIT compiler (Graal) §  JEP 319: Root Certificates

– default set of root CA certificates §  JEP 296: Consolidate JDK forests into single repo

– Eight repos becomes one

24

Page 25: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 10: JEPs §  JEP 316: Heap allocation on alternative devices (Intel)

–  NV-RAM with same semantics as DRAM

§  JEP 313: Remove javah tool – Same functionality through javac

§  JEP 304: Garbage Collector Interface (Red Hat) – Easier to add new algorithms (JVM internal)

§  JEP 312: Thread-Local Handshakes – Execute callbacks on threads without performing a global

VM safepoint

25

Page 26: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 10: APIs §  73 New APIs

– List, Set, Map.copyOf(Collection)– Collectors

§ toUnmodifiableList§ toUnmodifiableMap§ toUnmodifiableSet

– Optional.orElseThrow()

26

Page 27: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 10: Miscellaneous §  XMLInputFactory.newFactory() de-deprecated

(precated?) §  com.sun.security.auth package

– Six deprecated classes removed §  java.lang.SecurityManager

– One deprecated field and seven methods removed §  JVM now more Docker container aware

– Uses container CPU count and memory size – Namespace issues resolved (pids)

27

Page 28: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 11

Page 29: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 11 §  17 JEPs §  3 from outside Oracle

– JEP 318: Epsilon garbage collector (Red Hat) – JEP 315: Improve Aarch64 intrinsics (Red Hat) – JEP 331: Low overhead heap profiling (Google)

29

Page 30: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 11: JEPs §  JEP 309: Dynamic Class-file constants

– Like invokedynamic but for class-file constants – Bootstrap method used at runtime, not compile time – Useful for compiler and language developers

§  JEP 328: Flight Recorder – Final piece of aligning OpenJDK and Oracle JDK

30

Page 31: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 11: JEPs §  JEP 320: Remove CORBA and Java EE modules

– The power of a module system §  JEP 321: HTTP client

– HTTP/2 support – Incubating module from JDK 9 standardised

§  JEP 323: Local variable syntax for Lambda parameters – Extending JEP 286 in JDK 10 – (varx,vary)->x.process(y)

31

Page 32: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 11: JEPs §  JEP 324: Key Agreement with Curve25519 and Curve448

– More efficient and secure than existing ECDH §  JEP 327: Unicode 10

– 8,518 new characters (seriously) – Bitcoin symbol, Nishu, Soyombo, Zanabazar Square – Long awaited (?) Colbert emoji

32

Page 33: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JDK 11: New APIs §  New methods but no new classes

– InputStreamnullInputStream()– WriternullWriter()– Pathof(String,String...)

33

Page 34: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Longer Term JDK Futures

Page 35: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

OpenJDK Projects §  Amber

–  Simplifying syntax

§  Valhalla –  Value types and specialised generics

§  Loom –  Continuations and fibres

§  Metropolis –  The JVM re-written in Java

§  Panama –  FFI replacement for JNI

35

Page 36: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Project Amber §  JEP 286: Local variable type inference

– Delivered in JDK 10 §  JEP 323: Local variable syntax for Lambdas

– Will be delivered in JDK 11

36

Page 37: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Project Amber §  JEP 302: Lambda leftovers

– Single underscore for unused parameters §  JEP 326: Raw string literals (JDK 12)

– Use single backquote – `c:\Users\simon`– ```Astringwitha``init```

37

Page 38: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JEP 305: Pattern Matching §  Type test and switch statement support to start

38

Stringformatted;switch(obj){caseIntegeri:formatted=String.format("int%d",i);break;caseByteb:formatted=String.format("byte%d",b);break;caseLongl:formatted=String.format("long%d",l);break;caseDoubled:formatted=String.format("double%f",d);break;caseStrings:formatted=String.format("String%s",s);breakdefault:formatted=obj.toString();}

Page 39: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JEP 325: Switch Expressions (JDK 12)

39

intnumLetters;switch(day){caseMONDAY:caseFRIDAY:caseSUNDAY:numLetters=6;break;caseTUESDAY:numLetters=7;break;caseTHURSDAY:caseSATURDAY:numLetters=8;break;caseWEDNESDAY:numLetters=9;break;default:thrownewIllegalStateException("Huh?:"+day);};

Page 40: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

JEP 325: Switch Expressions

intnumLetters=switch(day){caseMONDAY,FRIDAY,SUNDAY->6;caseTUESDAY->7;caseTHURSDAY,SATURDAY->8;caseWEDNESDAY->9;default->thrownewIllegalStateException("Huh?:"+day);};

Page 41: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Project Valhalla §  Java has:

– Primitives: for performance – Objects: for encapsulation, polymorphism, inheritance, OO

§  Problem is where we want to use primitives but can't – ArrayList<int> won't work – ArrayList<Integer> requires boxing and unboxing,

object creation, heap overhead, indirection reference

41

Page 42: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Project Valhalla §  Value types §  "Codes like a class, works like a primitive"

– Can have methods and fields – Can implement interfaces – Can use encapsulation – Can be generic – Can't be mutated – Can't be sub-classed

42

Page 43: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Project Loom §  Further work on making concurrent programming simpler

– Threads are too heavyweight §  Loom will introduce fibres

–  JVM level threads (remember green threads?) – Add continuations to the JVM – Use the ForkJoinPool scheduler – Much lighter weight than threads

§ Less memory § Close to zero overhead for task switching

43

Page 44: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Project Metropolis §  Run Java on Java

– Rewrite most of the JVM in Java §  Use the Graal compiler project as significant input §  Easier ports to new platforms

– Less native code to modify and compile §  Faster new features on front-end

– Easier to write Java than C++ §  Performance is an issue to be explored and resolved

– AOT compiler in JDK 9 is the start of this

44

Page 45: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Azul's Zulu Java

Page 46: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Zulu Java §  Azul’s free binary distribution of OpenJDK

– Passes all TCK tests §  JDK 6, 7, 8, 9,10 and 11 (EA) available §  Wider platform support:

– Intel 64-bit Windows, Mac, Linux – Intel 32-bit Windows and Linux – ARM 32 and 64-bit – PowerPC

46

www.azul.com/downloads/zulu

Page 47: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Summary

Page 48: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

Java Continues To Evolve §  Faster Java releases

– Feature release every 6 months – Access to free updates is a consideration

§  Lots of ideas to improve Java – Value types, fibres, syntax improvements

§  Zulu Java has wide platform and JDK version support – Very reasonable cost for commercial support

48

Page 49: JDK 9, 10, 11 and Beyond: Delivering New Features …2011/09/10  · JDK 9: The Clean Up Starts JDK 9 was a significant change for Java – Deprecated APIs were removed for the first

© Copyright Azul Systems 2018

© Copyright Azul Systems 2015

@speakjava azul.com

Thank You!

Simon Ritter Deputy CTO, Azul Systems

49


Top Related