SlideShare a Scribd company logo
sbordet@webtide.com
Java 9/10/11
What’s new and why you should upgrade
@simonebordet
sbordet@webtide.com
Simone Bordet
● @simonebordet
● sbordet@webtide.com
● Java Champion
● Works @ Webtide
○ The company behind Jetty and CometD
sbordet@webtide.com
Java 11
● Java 11 is here!
● “Long Term Support” (LTS) Release
○ Java 8 was the previous LTS Release
○ Java 9 and Java 10 already unmaintained
sbordet@webtide.com
Java 11
OpenJDK 11 Repository
https://hg.openjdk.java.net
Oracle JDK Binary
https://java.oracle.com
OpenJDK Binary
http://jdk.java.net/11
RedHat JDK
Binary
Azul JDK Binary (Zulu)
AdoptOpenJDK Binary
https://adoptopenjdk.net
sbordet@webtide.com
Java 11
● What does LTS really mean?
● During the 6 months of “life” of a Java 11:
○ OpenJDK Binary -> GPL
○ AdoptOpenJDK -> GPL
○ Azul Zulu -> GPL
○ Oracle JDK Binary -> Oracle License
■ MUST PAY Oracle for production use
sbordet@webtide.com
Java 11
● After the 6 months of “life” of a Java 11:
○ Upgrade to Java 12
○ Stay on Java 11
sbordet@webtide.com
● After 6 months, you stay on Java 11
○ Never update -> exposed to vulnerabilities
○ Update Java 11 -> 11.0.x
● Community (RedHat) backports fixes
● Vendors create binary builds
○ AdoptOpenJDK -> GPL
○ Other vendors (Oracle, Azul, RedHat, …) -> PAY
Java 11
sbordet@webtide.com
Java 9
New Features
sbordet@webtide.com
Java 9
● Java 9 introduced the Java Module System
● Along with it, a number of breaking changes
○ Upgrading from 8 to 9/10/11 is NOT simple
○ Many runtime behavior changes
○ Needs very thorough testing
sbordet@webtide.com
Java 9
● Removed tools.jar
○ Attach API, Compiler API, JavaDoc API, etc.
● Removed JavaDB
● Removed endorsed and extension directories
○ $JAVA_HOME/lib/endorsed
○ $JAVA_HOME/jre/lib/ext
sbordet@webtide.com
Java 9
● Class loading implementation changed
○ Different behavior to support modules
ClassLoader sysCL = ClassLoader.getSystemClassLoader();
// Throws ClassCastException now!
URLClassLoader urlCL = (URLClassLoader)sysCL;
sbordet@webtide.com
Java 9
● Loading resources
URL resource = sysCL.getResource("java/lang/String.class");
// Not a file:/ nor a jar:/ URL!
resource = jrt:/java.base/java/lang/String.class
URL resource = sysCL.getResource("/com/foo/bar.properties");
// It’s there, but it won’t find it!
resource = null;
sbordet@webtide.com
Java 9
● New version string scheme
○ 1.8.0_181 -> 9.0.1
○ Broke many Maven Plugins, Jetty, etc.
● JDK 9’s java.lang.Runtime.Version class
○ Cannot parse JDK 8 version string
○ Must implement custom parsing to support both
sbordet@webtide.com
Java 9
● Internal APIs encapsulated
○ Cannot access sun.* or com.sun.* classes
● Finalization
○ sun.misc.Cleaner -> java.lang.ref.Cleaner
○ Object.finalize() -> deprecated
● Unsafe
○ Some sun.misc.Unsafe usage replaced by VarHandle
sbordet@webtide.com
Java 9
● Multi Release jars
com/
acme/
A.class
B.class
META-INF/
versions/
9/
com/
acme/
A.class <- Replaces normal A.class
C.class
sbordet@webtide.com
Java 9
● Variable Handles
○ Expose some Unsafe functionality
class ConcurrentLinkedQueue_BAD {
// BAD, adds indirection
AtomicReference<Node> head;
}
sbordet@webtide.com
Java 9
class ConcurrentLinkedQueue {
private Node head;
private static final VarHandle HEAD;
static {
HEAD = MethodHandles.lookup()
.findVarHandle(ConcurrentLinkedQueue.class,
"head", Node.class);
}
public void m() {
if (HEAD.compareAndSet(...))
...
}
}
}
sbordet@webtide.com
Java 9
● Process APIs
Process p = new ProcessBuilder()
.command("java")
.directory(new File("/tmp"))
.redirectOutput(Redirect.DISCARD)
.start();
ProcessHandle.of(p.pid())
.orElseThrow(IllegalStateException::new)
.onExit()
.thenAccept(h ->
System.err.printf("%d exited%n", h.pid())
);
sbordet@webtide.com
Java 9
● Concurrent APIs Enhancements
○ java.util.concurrent.Flow
■ Identical APIs and semantic of ReactiveStreams
○ CompletableFuture enhancements
■ Common scheduler for timeout functionalities
CompletableFuture.supplyAsync(() -> longJob())
.completeOnTimeout("N/A", 1, TimeUnit.SECONDS)
CompletableFuture.supplyAsync(() -> longJob())
.orTimeout(1, TimeUnit.SECONDS)
sbordet@webtide.com
Java 9
● jshell - Read-Eval-Print-Loop (REPL)
● Pretty powerful!
○ AutoCompletion, Imports, Javadocs
○ History, search
○ Syncs with external editor
○ Function and forward references
○ ...
sbordet@webtide.com
Java 9
● G1 is the default Garbage Collector
● Much improved from 8 and even better in 11
○ Adaptive start of concurrent mark
○ Made internal data structures more concurrent
○ More phases parallelized
○ Reduced contention
○ Reduced memory consumption
sbordet@webtide.com
Java 9
● Unified GC logging
○ Not compatible with previous GC logs
● Every GC logs differently
● Example
○ -
Xlog:gc*,ergo*=trace,ref*=debug:file=log
s/gc.log:time,level,tags
sbordet@webtide.com
Java 9
● JVM options changes
○ 50 options removed - JVM refuses to start
○ 18 options ignored - 12 options deprecated
● Must review your command line!
○ Especially if you had custom GC tuning options
sbordet@webtide.com
Java 10
New Features
sbordet@webtide.com
Java 10
● Local variable type inference (a.k.a. var)
○ http://openjdk.java.net/projects/amber/LVTIstyle.html
// Infers ArrayList<String>
var list = new ArrayList<String>();
// infers Stream<String>
var stream = list.stream();
sbordet@webtide.com
Java 10
● var is not a keyword, it is a reserved type name
○ It’s a valid identifier, unless used in places where the
compiler expects a type name
int var = 13;
sbordet@webtide.com
Java 10
● Good var usage
var message = "warning, too many features";
var anon = new Object() {
int count = 0;
}
anon.count++; // Compiles!
sbordet@webtide.com
Java 10
● Controversial var usage
// What type ?
var result = processor.run();
// IDE cannot help you
var list = new <ctrl+space>
sbordet@webtide.com
Java 10
● Experimental Graal JIT
○ https://www.graalvm.org/
● -XX:+UnlockExperimentalVMOptions -XX:
+UseJVMCICompiler
● Not yet recommended in production
○ Twitter uses it in production, you may too (YMMV)
sbordet@webtide.com
Java 10
● Docker awareness
○ On by default
○ https://blog.docker.com/2018/04/improved-docker-containe
-XX:-UseContainerSupport
-XX:ActiveProcessorCount=n
-XX:MinRAMPercentage=p
-XX:InitialRAMPercentage=p
-XX:MaxRAMPercentage=p
sbordet@webtide.com
Java 11
New Features
sbordet@webtide.com
Java 11
● Two new Garbage Collectors
○ Epsilon GC
○ ZGC
● Epsilon GC
○ No-operation GC
sbordet@webtide.com
● ZGC
○ 5 years of closed source development @ Oracle
○ XX:+UnlockExperimentalVMOptions XX:+UseZGC
○ Single Generation, Region Based
○ Concurrent Marking
○ Concurrent Compaction
○ Very low STW pause times
Java 11
sbordet@webtide.com
Java 11
● Removed methods
○ Thread.stop(Throwable)
○ Thread.destroy()
○ System.runFinalizersOnExit(boolean)
○ Some SecurityManager.check*() methods
sbordet@webtide.com
Java 11
● Removed modules
○ java.activation (JAF)
○ java.corba
○ java.transaction (JTA)
○ java.xml.bind (JAXB)
○ java.xml.ws (JAX-WS)
○ java.xml.ws.annotation (@PostConstruct, ...)
● Replaced by standalone jars
○ https://dzone.com/articles/apis-to-be-removed-from-java-11
sbordet@webtide.com
Java 11
● Java Flight Recorder
○ Open Sourced by Oracle, included in OpenJDK 11
○ java -XX:StartFlightRecording ...
● Java Mission Control
○ Open Sourced by Oracle
○ Downloads at https://jdk.java.net/jmc/
○ JMC 7 scheduled for January 2019
sbordet@webtide.com
Java 11
● TLS 1.3
○ More secure and recent version of TLS
○ Removed vulnerable/weak ciphers
○ Added new ciphers and algorithms
● Using SSLEngine? Verify it works!
sbordet@webtide.com
Java 11
● Launch Single-File Source-Code programs
$ java Hello.java
● Compiled in-memory with Graal
● Teaching
● Java Scripts
sbordet@webtide.com
Java 11
● HTTP client
○ Supports both HTTP/1.1 and HTTP/2
○ Based on the j.u.c.Flow APIs
HttpClient c = HttpClient.newBuilder().build();
HttpRequest r = HttpRequest.newBuilder()
.uri(...).build();
CompletableFuture<String> f = c.sendAsync(r,
BodyHandlers.ofString());
sbordet@webtide.com
Java 11
● Nest Mates
○ Inner (nested) classes introduced in Java 1.1
○ Outer class can access inner class
■ Via compiler tricks - bridge methods
java.lang.UnsupportedOperationException
at NestExample.init(NestExample.java)
at NestExample.access$000(NestExample.java)
at NestExample$Inner.(NestExample.java)
at NestExample.main(NestExample.java)
sbordet@webtide.com
Java 11
● Nest Mates
○ Now specified in the JVM Specification
○ New class file attribute
○ New reflection APIs: Class.getNestMembers(), ...
○ New JVM access controls at runtime
● Do you play with bytecode?
○ Use ASM 7+
sbordet@webtide.com
Conclusions
sbordet@webtide.com
Conclusions
● Upgrade from Java 8 takes time
○ Lots of runtime changes
● Java 8 will be soon unmaintained / unavailable
○ Skip Java 9 and Java 10 - go straight to Java 11
● Lots of good stuff and more coming
○ And coming every 6 months now!
sbordet@webtide.com
Questions?

More Related Content

PDF
Java11 New Features
PDF
Java Concurrency by Example
PPTX
What's new in Java 11
PDF
Java 9 New Features
PDF
Introduction to Java 11
PPT
Jsp/Servlet
ODP
Java 9 Features
PDF
Understanding Reactive Programming
Java11 New Features
Java Concurrency by Example
What's new in Java 11
Java 9 New Features
Introduction to Java 11
Jsp/Servlet
Java 9 Features
Understanding Reactive Programming

What's hot (20)

PDF
Java 10 New Features
PPTX
Java 8 lambda
PDF
Lambda Expressions in Java
PPTX
Spring boot Introduction
PDF
Deep Dive Java 17 Devoxx UK
PDF
Introduction to java (revised)
PDF
Hibernate Presentation
PDF
GraalVM Overview Compact version
PPTX
What is component in reactjs
PDF
Basic Java Programming
PPTX
Introduction to java
PDF
From Java 11 to 17 and beyond.pdf
PDF
Nouveautés Java 9-10-11
PPTX
Core Java Tutorials by Mahika Tutorials
PDF
Java 8-streams-collectors-patterns
PPT
Inheritance C#
PPT
Core java concepts
PDF
Pwning mobile apps without root or jailbreak
PPTX
Spring Boot
PPTX
Java 10 New Features
Java 8 lambda
Lambda Expressions in Java
Spring boot Introduction
Deep Dive Java 17 Devoxx UK
Introduction to java (revised)
Hibernate Presentation
GraalVM Overview Compact version
What is component in reactjs
Basic Java Programming
Introduction to java
From Java 11 to 17 and beyond.pdf
Nouveautés Java 9-10-11
Core Java Tutorials by Mahika Tutorials
Java 8-streams-collectors-patterns
Inheritance C#
Core java concepts
Pwning mobile apps without root or jailbreak
Spring Boot
Ad

Similar to Java 9/10/11 - What's new and why you should upgrade (20)

PDF
Java 9-10 What's New
ODP
Java 10 - Updates
ODP
Java 9 - Part1: New Features (Not Jigsaw Modules)
PDF
QConSP 2018 - Java Module System
PPTX
Prepare for JDK 9
PDF
Java 9 and Project Jigsaw
PPTX
Using FXML on Clojure
PPTX
Dart the Better JavaScript
PPTX
Java and OpenJDK: disecting the ecosystem
PDF
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
PDF
Java SE 9 modules - an introduction (July 2018)
PDF
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
PDF
Jigsaw - Javaforum 2015Q4
PDF
GeoServer Developers Workshop
PDF
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
PDF
Ad111
PDF
Native Java with GraalVM
ODP
Javascript training sample
PDF
Whats new in Java 9,10,11,12
PDF
Java 8 Lambda
Java 9-10 What's New
Java 10 - Updates
Java 9 - Part1: New Features (Not Jigsaw Modules)
QConSP 2018 - Java Module System
Prepare for JDK 9
Java 9 and Project Jigsaw
Using FXML on Clojure
Dart the Better JavaScript
Java and OpenJDK: disecting the ecosystem
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Java SE 9 modules - an introduction (July 2018)
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
Jigsaw - Javaforum 2015Q4
GeoServer Developers Workshop
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
Ad111
Native Java with GraalVM
Javascript training sample
Whats new in Java 9,10,11,12
Java 8 Lambda
Ad

More from Simone Bordet (6)

PDF
Java 13 Updates
ODP
Java 9 - Part 2: Jigsaw Modules
ODP
G1 Garbage Collector: Details and Tuning
ODP
Servlet 3.1 Async I/O
ODP
HTTP/2 and Java: Current Status
ODP
Cloud-Ready Web Messaging with CometD
Java 13 Updates
Java 9 - Part 2: Jigsaw Modules
G1 Garbage Collector: Details and Tuning
Servlet 3.1 Async I/O
HTTP/2 and Java: Current Status
Cloud-Ready Web Messaging with CometD

Recently uploaded (20)

PDF
System and Network Administration Chapter 2
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
medical staffing services at VALiNTRY
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
ai tools demonstartion for schools and inter college
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Transform Your Business with a Software ERP System
PDF
System and Network Administraation Chapter 3
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
history of c programming in notes for students .pptx
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
AI in Product Development-omnex systems
System and Network Administration Chapter 2
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
medical staffing services at VALiNTRY
Softaken Excel to vCard Converter Software.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
How to Migrate SBCGlobal Email to Yahoo Easily
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
ai tools demonstartion for schools and inter college
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 41
CHAPTER 2 - PM Management and IT Context
How Creative Agencies Leverage Project Management Software.pdf
Transform Your Business with a Software ERP System
System and Network Administraation Chapter 3
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Odoo POS Development Services by CandidRoot Solutions
history of c programming in notes for students .pptx
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
AI in Product Development-omnex systems

Java 9/10/11 - What's new and why you should upgrade

  • 1. sbordet@webtide.com Java 9/10/11 What’s new and why you should upgrade @simonebordet
  • 2. sbordet@webtide.com Simone Bordet ● @simonebordet ● sbordet@webtide.com ● Java Champion ● Works @ Webtide ○ The company behind Jetty and CometD
  • 3. sbordet@webtide.com Java 11 ● Java 11 is here! ● “Long Term Support” (LTS) Release ○ Java 8 was the previous LTS Release ○ Java 9 and Java 10 already unmaintained
  • 4. sbordet@webtide.com Java 11 OpenJDK 11 Repository https://hg.openjdk.java.net Oracle JDK Binary https://java.oracle.com OpenJDK Binary http://jdk.java.net/11 RedHat JDK Binary Azul JDK Binary (Zulu) AdoptOpenJDK Binary https://adoptopenjdk.net
  • 5. sbordet@webtide.com Java 11 ● What does LTS really mean? ● During the 6 months of “life” of a Java 11: ○ OpenJDK Binary -> GPL ○ AdoptOpenJDK -> GPL ○ Azul Zulu -> GPL ○ Oracle JDK Binary -> Oracle License ■ MUST PAY Oracle for production use
  • 6. sbordet@webtide.com Java 11 ● After the 6 months of “life” of a Java 11: ○ Upgrade to Java 12 ○ Stay on Java 11
  • 7. sbordet@webtide.com ● After 6 months, you stay on Java 11 ○ Never update -> exposed to vulnerabilities ○ Update Java 11 -> 11.0.x ● Community (RedHat) backports fixes ● Vendors create binary builds ○ AdoptOpenJDK -> GPL ○ Other vendors (Oracle, Azul, RedHat, …) -> PAY Java 11
  • 9. sbordet@webtide.com Java 9 ● Java 9 introduced the Java Module System ● Along with it, a number of breaking changes ○ Upgrading from 8 to 9/10/11 is NOT simple ○ Many runtime behavior changes ○ Needs very thorough testing
  • 10. sbordet@webtide.com Java 9 ● Removed tools.jar ○ Attach API, Compiler API, JavaDoc API, etc. ● Removed JavaDB ● Removed endorsed and extension directories ○ $JAVA_HOME/lib/endorsed ○ $JAVA_HOME/jre/lib/ext
  • 11. sbordet@webtide.com Java 9 ● Class loading implementation changed ○ Different behavior to support modules ClassLoader sysCL = ClassLoader.getSystemClassLoader(); // Throws ClassCastException now! URLClassLoader urlCL = (URLClassLoader)sysCL;
  • 12. sbordet@webtide.com Java 9 ● Loading resources URL resource = sysCL.getResource("java/lang/String.class"); // Not a file:/ nor a jar:/ URL! resource = jrt:/java.base/java/lang/String.class URL resource = sysCL.getResource("/com/foo/bar.properties"); // It’s there, but it won’t find it! resource = null;
  • 13. sbordet@webtide.com Java 9 ● New version string scheme ○ 1.8.0_181 -> 9.0.1 ○ Broke many Maven Plugins, Jetty, etc. ● JDK 9’s java.lang.Runtime.Version class ○ Cannot parse JDK 8 version string ○ Must implement custom parsing to support both
  • 14. sbordet@webtide.com Java 9 ● Internal APIs encapsulated ○ Cannot access sun.* or com.sun.* classes ● Finalization ○ sun.misc.Cleaner -> java.lang.ref.Cleaner ○ Object.finalize() -> deprecated ● Unsafe ○ Some sun.misc.Unsafe usage replaced by VarHandle
  • 15. sbordet@webtide.com Java 9 ● Multi Release jars com/ acme/ A.class B.class META-INF/ versions/ 9/ com/ acme/ A.class <- Replaces normal A.class C.class
  • 16. sbordet@webtide.com Java 9 ● Variable Handles ○ Expose some Unsafe functionality class ConcurrentLinkedQueue_BAD { // BAD, adds indirection AtomicReference<Node> head; }
  • 17. sbordet@webtide.com Java 9 class ConcurrentLinkedQueue { private Node head; private static final VarHandle HEAD; static { HEAD = MethodHandles.lookup() .findVarHandle(ConcurrentLinkedQueue.class, "head", Node.class); } public void m() { if (HEAD.compareAndSet(...)) ... } } }
  • 18. sbordet@webtide.com Java 9 ● Process APIs Process p = new ProcessBuilder() .command("java") .directory(new File("/tmp")) .redirectOutput(Redirect.DISCARD) .start(); ProcessHandle.of(p.pid()) .orElseThrow(IllegalStateException::new) .onExit() .thenAccept(h -> System.err.printf("%d exited%n", h.pid()) );
  • 19. sbordet@webtide.com Java 9 ● Concurrent APIs Enhancements ○ java.util.concurrent.Flow ■ Identical APIs and semantic of ReactiveStreams ○ CompletableFuture enhancements ■ Common scheduler for timeout functionalities CompletableFuture.supplyAsync(() -> longJob()) .completeOnTimeout("N/A", 1, TimeUnit.SECONDS) CompletableFuture.supplyAsync(() -> longJob()) .orTimeout(1, TimeUnit.SECONDS)
  • 20. sbordet@webtide.com Java 9 ● jshell - Read-Eval-Print-Loop (REPL) ● Pretty powerful! ○ AutoCompletion, Imports, Javadocs ○ History, search ○ Syncs with external editor ○ Function and forward references ○ ...
  • 21. sbordet@webtide.com Java 9 ● G1 is the default Garbage Collector ● Much improved from 8 and even better in 11 ○ Adaptive start of concurrent mark ○ Made internal data structures more concurrent ○ More phases parallelized ○ Reduced contention ○ Reduced memory consumption
  • 22. sbordet@webtide.com Java 9 ● Unified GC logging ○ Not compatible with previous GC logs ● Every GC logs differently ● Example ○ - Xlog:gc*,ergo*=trace,ref*=debug:file=log s/gc.log:time,level,tags
  • 23. sbordet@webtide.com Java 9 ● JVM options changes ○ 50 options removed - JVM refuses to start ○ 18 options ignored - 12 options deprecated ● Must review your command line! ○ Especially if you had custom GC tuning options
  • 25. sbordet@webtide.com Java 10 ● Local variable type inference (a.k.a. var) ○ http://openjdk.java.net/projects/amber/LVTIstyle.html // Infers ArrayList<String> var list = new ArrayList<String>(); // infers Stream<String> var stream = list.stream();
  • 26. sbordet@webtide.com Java 10 ● var is not a keyword, it is a reserved type name ○ It’s a valid identifier, unless used in places where the compiler expects a type name int var = 13;
  • 27. sbordet@webtide.com Java 10 ● Good var usage var message = "warning, too many features"; var anon = new Object() { int count = 0; } anon.count++; // Compiles!
  • 28. sbordet@webtide.com Java 10 ● Controversial var usage // What type ? var result = processor.run(); // IDE cannot help you var list = new <ctrl+space>
  • 29. sbordet@webtide.com Java 10 ● Experimental Graal JIT ○ https://www.graalvm.org/ ● -XX:+UnlockExperimentalVMOptions -XX: +UseJVMCICompiler ● Not yet recommended in production ○ Twitter uses it in production, you may too (YMMV)
  • 30. sbordet@webtide.com Java 10 ● Docker awareness ○ On by default ○ https://blog.docker.com/2018/04/improved-docker-containe -XX:-UseContainerSupport -XX:ActiveProcessorCount=n -XX:MinRAMPercentage=p -XX:InitialRAMPercentage=p -XX:MaxRAMPercentage=p
  • 32. sbordet@webtide.com Java 11 ● Two new Garbage Collectors ○ Epsilon GC ○ ZGC ● Epsilon GC ○ No-operation GC
  • 33. sbordet@webtide.com ● ZGC ○ 5 years of closed source development @ Oracle ○ XX:+UnlockExperimentalVMOptions XX:+UseZGC ○ Single Generation, Region Based ○ Concurrent Marking ○ Concurrent Compaction ○ Very low STW pause times Java 11
  • 34. sbordet@webtide.com Java 11 ● Removed methods ○ Thread.stop(Throwable) ○ Thread.destroy() ○ System.runFinalizersOnExit(boolean) ○ Some SecurityManager.check*() methods
  • 35. sbordet@webtide.com Java 11 ● Removed modules ○ java.activation (JAF) ○ java.corba ○ java.transaction (JTA) ○ java.xml.bind (JAXB) ○ java.xml.ws (JAX-WS) ○ java.xml.ws.annotation (@PostConstruct, ...) ● Replaced by standalone jars ○ https://dzone.com/articles/apis-to-be-removed-from-java-11
  • 36. sbordet@webtide.com Java 11 ● Java Flight Recorder ○ Open Sourced by Oracle, included in OpenJDK 11 ○ java -XX:StartFlightRecording ... ● Java Mission Control ○ Open Sourced by Oracle ○ Downloads at https://jdk.java.net/jmc/ ○ JMC 7 scheduled for January 2019
  • 37. sbordet@webtide.com Java 11 ● TLS 1.3 ○ More secure and recent version of TLS ○ Removed vulnerable/weak ciphers ○ Added new ciphers and algorithms ● Using SSLEngine? Verify it works!
  • 38. sbordet@webtide.com Java 11 ● Launch Single-File Source-Code programs $ java Hello.java ● Compiled in-memory with Graal ● Teaching ● Java Scripts
  • 39. sbordet@webtide.com Java 11 ● HTTP client ○ Supports both HTTP/1.1 and HTTP/2 ○ Based on the j.u.c.Flow APIs HttpClient c = HttpClient.newBuilder().build(); HttpRequest r = HttpRequest.newBuilder() .uri(...).build(); CompletableFuture<String> f = c.sendAsync(r, BodyHandlers.ofString());
  • 40. sbordet@webtide.com Java 11 ● Nest Mates ○ Inner (nested) classes introduced in Java 1.1 ○ Outer class can access inner class ■ Via compiler tricks - bridge methods java.lang.UnsupportedOperationException at NestExample.init(NestExample.java) at NestExample.access$000(NestExample.java) at NestExample$Inner.(NestExample.java) at NestExample.main(NestExample.java)
  • 41. sbordet@webtide.com Java 11 ● Nest Mates ○ Now specified in the JVM Specification ○ New class file attribute ○ New reflection APIs: Class.getNestMembers(), ... ○ New JVM access controls at runtime ● Do you play with bytecode? ○ Use ASM 7+
  • 43. sbordet@webtide.com Conclusions ● Upgrade from Java 8 takes time ○ Lots of runtime changes ● Java 8 will be soon unmaintained / unavailable ○ Skip Java 9 and Java 10 - go straight to Java 11 ● Lots of good stuff and more coming ○ And coming every 6 months now!