Share
Embed
9 Lives of Java 9
Not a simple "what's new", since I'm also examining history of the language, trying to show what led to current state and Jigsaw being necessary.
This includes new announcements about JDK 18.03, JDK10, new Java release cadence, Java EE and all recent (and not so recent) highlights showing I was right speaking about Java transition.
If time permits, there's also trivia game and demo.
Tomasz Borek
December 18, 2016
Annual Pro sale · Save $30
Have presentations of your own?
Share with private links, password protection, and more control over your work.
Transcript
80 slides
-
Currently • Kraków • Newbies or juniors • 3-5 months
• To programmers • Or as close as I can • With JS, QA, etc. • 4th edition Nov 2017 -
Green project • The Green Team • Smart appliances •
C++ extension → Oak → Green Platform (and OS)→ Java • Star 7 (summer 1992) -
Ends because... • Too much control in hands of the
users – Cable TV industry wants dumber remotes • PDAs didn’t quite took off • Instead, World Wide Web did – Hence, WebRunner → HotJava, browser – Appropriate interactivity – 1994 – retargeting to WWW – 1995 – HotJava – 1996... -
WORA • JIT (Just In Time) compiler for Windows •
Network byte order • So, all that to run C code? -
JDK 1.02, first Java • AWT event model • Inner
classes • JavaBeans • JDBC • RMI • Reflection (introspection only, TBH) • GC • VM • MCM (green threads) • Sandbox February 19, 1997 -
Playground • Tripled in size • Introduced JCF • strictfp
keyword • Swing graphical API • Sun’s JVM had a JIT compiler now • Java plug-in -
Enterprise • Lovely Sun marketing – SE, ME, EE •
Enterprise rulz – J2EE :-) • EJBOSS • Standards are hard • Desktop? Forget it! -
Spreading the wings • Kestrel (1.3, right) – improvements everywhere
(PermGen, HotSpot JVM). JNDI and JPDA though! • Merlin had APIs and libs: NIO, JAXP, Logging, JDBC 3, Preferences, Ipv6, RegEx, Images. Plus Java Web Start, assert and chaining exceptions. -
First community edition • As JSR-59 • Java Community Process
• February 6th, 2002 -
Tiger • Majority of interview questions – Next big thing
is JDK8 • Enum, annotations, generics, foreach, varargs, auto-/un- boxing, concurrency, scanner... • Improved JMCM! -
Mustang and Dolphin • Invokedynamic • 64bit pointers • Coin
• 8 and 9 • perf • JVM perf • GUI (Swing) • javac, JDBC 4, JAXB 2 http://openjdk.java.net/projects/coin/ -
Ends because... • Too much chaos in marketing • Too
much problems with enterprise -
RIP October 08, 2013: if Java is dying, it sure
looks awfully healthy -
Current Life (5th) @LAFK_pl March 18, 2014 September 21, 2017
Consultant @ JDK 8 -
So, JDK 8 JEPS? 55 all together GA on 14th
March 2014 Maurice Naftalin Lambda FAQ -
Project λ • Functions are first-class citizens (almost) – Anonymous
classes still but – Function interface – @FunctionalInterface • Method refs • Change your thinking • Immutability, effectively final vars • Coupled with streams -
Project λ + Streams • Functions are first-class citizens (almost)
– Anonymous classes still but – Function interface – @FunctionalInterface • Method refs • Change your thinking • Immutability, effectively final vars • Coupled with streams -
So, JDK 9 JEPS? 91 all together GA on 21st
September 2017 lafk.pl/jdk9-on-jdd/ -
Project Kulla = JShell • 222: jshell – the Java
shell (REPL) • Kulla – builder god, banished when done • https://docs.oracle.com/javase/9/tools/jshell.htm • /aCommand → /exit /help intro /help shortcuts • /list • /save • /open some-jshell-file.jsh -
Project Kulla = JShell • 222: jshell – the Java
shell (REPL) • Features Tab-completion, quite nice at that! • Jline uses C readline lib • Look for ~/.inputrc or /etc/input.rc -
Project Kulla = JShell • Build web-app with REPL with
Kuba Marchwicki -
Project Jigsaw • JAR hell, classpath loading problems • JARs
are not components, they are files • JDK and most Java apps are monoliths • JDK weighs a lot • Your Java app weighs a lot • µservices aren’t monolithic (shouldn’t be!) • Game changers! -
Project Jigsaw • Rabea Gransberger – refactor to modules •
Mark Reinhold – State of the modules system – http://openjdk.java.net/projects/jigsaw/spec/sotms/ – Java One sessions • My own 9 Lives of Java 9 – https://github.com/LIttleAncientForestKami/j9-intro • http://openjdk.java.net/projects/jigsaw -
Project Jigsaw - JEPs • 162: Prepare for Modularisation •
200: The Modular JDK • 201: Modular Source Code (Jigsaw itself) • 220: Modular Run-Time images – Standard class libraries modularised (rt.jar) – Files more efficient than JAR • 260: Most internal APIs now encapsulated – Unsafe, VarHandles, MethodHandles • 275: java packager • 282: jlink, Java linker 7 in total -
Modules in a nutshell • Base always present • Requires
– modules you need • Exports – what you publish (here public matters) • Use – required services – via ServiceLoader • http://cr.openjdk.java.net/~mr/jigsaw/jdk9-module-summary.html • https://bugs.openjdk.java.net/secure/attachment/72525/jdk.png • module-info.java, module path • jlink, jdepend • https://github.com/accso/java9-jigsaw-depvis -
Default GC is G1 • JEP 248 • CMS deprecated
– ParNew as well • Regions, categorized • Huge objects • JEPs: – 250: Strings in CDSes – 214: remove deprecated combinations • Not for small heaps • String Deduplication – JEP 192, 8u20 -
Unicode, Javadoc, Nashorn • 221: Simplified Doclet API • 224:
HTML5 Javadoc • 225: Javadoc Search • 226: UTF-8 Property Files • 267: Unicode 8.0 (7,3k+) • 227: Unicode 7.0 (2,8k+) • 236: Parser API for Nashorn • 252: Use CLDR Locale Data by Default • 292: Implement Selected ECMAScript 6 Features in Nashorn 9 in total -
JEP 266: More concurrent updates • java.util.concurrent.Flow – Reactive programming
– http://www.reactive-streams.org/ - de-facto standard – PubSub: • CompleteableFuture (20 or so changes) – http://www.baeldung.com/java-9-completablefuture -
Things will be removed! • 277: Enhanced Deprecation • 289:
Deprecate the Applet API – forRemoval set to false • 214: Remove GC Combinations Deprecated in JDK 8 • 231: Remove Launch-Time JRE Version Selection • 240: Remove the JVM TI hprof Agent • 241: Remove the jhat Tool • 298: Remove Demos and Samples 5 in total -
Security • 219: Datagram Transport Layer Security (DTLS) • 229:
Create PKCS12 Keystores by Default • 244: TLS Application-Layer Protocol Negotiation Extension • 249: OCSP Stapling for TLS • 273: DRBG-Based SecureRandom Implementations • 287: SHA-3 Hash Algorithms • 288: Disable SHA-1 Certificates • 290: Filter Incoming Serialization Data 8 in total Another 8 in perf -
Libraries changes • 255: Merge Selected Xerces 2.11.0 Updates into
JAXP • 259: Stack-Walking API • 260: Encapsulate Most Internal APIs • 266: More Concurrent Updates • 269: Convenience Factory Methods for Collections 5 selected -
JVM changes • 193: Variable Handles • 245: Validate JVM
Command-Line Flag Arguments • 228: Add More Diagnostic Commands • 238: Multi-Release JAR Files • 247: Compile for Older Platform Versions • 223: New Version-String Scheme • 217: Annotations Pipeline 2.0 • 280: Indify String Concatenation • 272: Platform-Specific Desktop Features Whopping 32 in total • 233: Generate Run-Time Compiler Tests Automatically • 235: Test Class-File Attributes Generated by javac • 211: Elide Deprecation Warnings on Import Statements • 212: Resolve Lint and Doclint Warnings • 216: Process Import Statements Correctly • 279: Improve Test-Failure Troubleshooting • 281: HotSpot C++ Unit-Test Framework • 284: New HotSpot Build System • 248: Make G1 the Default Garbage Collector • 278: Additional Tests for Humongous Objects in G1 • 243: Java-Level JVM Compiler Interface • 270: Reserved Stack Areas for Critical Sections • 274: Enhanced Method Handles • 237: Linux/AArch64 Port • 158: Unified JVM Logging • 264: Platform Logging API and Service • 271: Unified GC Logging • 165: Compiler Control -
So...? • Jigsaw and modularity – Image, modules, JAR replace,
linking, deps finding • JVM – tooling, ground work (CLI, GC, String indify), • APIs – JShell, Stack Walking, Process, Flow • Performance, Security • Why? -
In short • Java went like a river, changing directions
– Smart appliances → net → EE → SE → FP – Devs see language changes, but there’s more • IoT, Big Data, Cloud (hence: FP, modularity) • Jigsaw is the theme, but foundations improved! – JDK, perf, Strings, compiler, GC, tooling – Stack, Process, Jshell, Xerces, Flow -
Java EE – Not J2EE, not anymore • Waited for
JDK9 and Jigsaw • Folks moved ahead though (without Oracle) – EE Guardians (https://javaee-guardians.io/) – MicroProfile (http://microprofile.io/) – Spring and container/server vendors • Good summary – https://www.infoq.com/news/2017/04/long-road-for-java-ee-8 • Donated to Eclipse Foundation! -
9 Lives of Java 9 @LAFK_pl Now it will move
faster! 4 remain! Consultant @ -
Java 18.03 • Every quarter (first month): bug fixes and
patches • Every March – feature release • Every September – LTS feature release – LTS – 3 years • https://mreinhold.org/blog/forward-faster -
JDK 10 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 • 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 http://openjdk.java.net/projects/jdk/10/#Schedule -
Minor JDK10 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 • 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 http://openjdk.java.net/projects/jdk/10/#Schedule -
GC JDK10 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 • 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 http://openjdk.java.net/projects/jdk/10/#Schedule -
GC JDK10 JEPs • 304: Garbage-Collector Interface • 307: Parallel
Full GC for G1 • 316: Heap Allocation on Alternative Memory Devices – -XX:AllocateHeapAt=<path> – NVDIMM, non-DRAM with DRAM semantics – Lower priority, larger capacity (than DRAM) -
GC JDK10 JEPs • 304: Garbage-Collector Interface • 307: Parallel
Full GC for G1 – -XX:ParallelGCThreads=<nr> – Affects Young and Mixed – ParallelGC has parallel full GC, so G1 should too • Now it’s single threaded • 316: Heap Allocation on Alternative Memory Devices -
GC JDK10 JEPs • 304: Garbage-Collector Interface – Core reorganization
– In future: Epsilon • 307: Parallel Full GC for G1 • 316: Heap Allocation on Alternative Memory Devices -
JDK 10 minor JEPs • 296: Consolidate the JDK Forest
into a Single Repository • 310: Application Class-Data Sharing • 313: Remove the Native-Header Generation Tool (javah) • 314: Additional Unicode Language-Tag Extensions • 319: Root Certificates • 322: Time-Based Release Versioning -
JEP-310: AppCDS • Since Tiger we can share class data
(CDS) – Only null class loader – Set of classes → mem-mapped archive – Such archive can be shared across JVMs • AppCDS: – System class loader (and custom ones) – java -Xshare:off -XX:+UseAppCDS -XX:DumpLoadedClassList=hello.lst -cp hello.jar HelloWorld -
JEP-313: remove javah • javah generates native header • No
longer used in JDK or during builds • javac (since JDK8) can write native header files (during compilation) • javac has API access through Compiler API or java.util.spi.ToolProvider – javah does not • Ergo - removal -
JDK 10 minor JEPs • 296: Consolidate the JDK Forest
into a Single Repository • 310: Application Class-Data Sharing • 313: Remove the Native-Header Generation Tool (javah) • 314: Additional Unicode Language-Tag Extensions • 319: Root Certificates • 322: Time-Based Release Versioning -
JEP-319: root certificates • Root cacerts keystore should have root
certs • OpenJDK cacerts store is empty • Oracle JDK is not • This JEP makes 17 companies that signed OCA open-source their root certs – TLS works from the start with it http://openjdk.java.net/jeps/319 -
Version string ➜ ~ /usr/lib/jvm/java-9-openjdk-amd64/bin/java -version openjdk version "9-internal" OpenJDK
Runtime Environment (build 9-internal+0-2016-04-14- 195246.buildd.src) OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14- 195246.buildd.src, mixed mode) ➜ ~ java -version java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode) -
Version string after JEP-223 // JDK 9, build 165, early
access ➜ /tmp/jdk-9/bin/java -version java version "9-ea" Java(TM) SE Runtime Environment (build 9- ea+165) Java HotSpot(TM) 64-Bit Server VM (build 9- ea+165, mixed mode) -
Version string after JEP-322 //build 13 JDK 10.0.1 $ java
--version openjdk 10.0.1 2018-04-19 OpenJDK Runtime Environment (build 10.0.1+13) OpenJDK 64-Bit Server VM (build 10.0.1+13, mixed mode) //build 42 JDK 11 LTS $ java --version openjdk 11 2018-09-20 LTS OpenJDK Runtime Environment (build 11+42-LTS) OpenJDK 64-Bit Server VM (build 11+42-LTS, mixed mode) -
Exciting JDK 10 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 • 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 http://openjdk.java.net/projects/jdk/10/#Schedule -
Exciting JDK 10 JEPs • 286: Local-Variable Type Inference –
var list = new ArrayList<String>(); • // infers ArrayList<String> – var stream = list.stream(); • // infers Stream<String> – Only in for loops (both) and method locals • 312: Thread-Local Handshakes – Inspect one thread at a time, less ‘safepointing’ • 317: Experimental Java-Based JIT Compiler – Graal, JIT done in Java, works on ASTs http://openjdk.java.net/projects/jdk/10/#Schedule -
In short • Java went like a river, changing directions
– Smart appliances → net → EE → SE → FP – You see where language changes, but there’s more • IoT, Big Data, Cloud (hence: FP, modularity) • Jigsaw is the theme, but foundations improved! • Transition has only began! JDK10, 11… -
9 Lives of Java 9 @LAFK_pl 21st September 2017 GA
March 2018 JDK 10! At least 4 remain! Consultant @