SlideShare une entreprise Scribd logo
1  sur  44
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?

Contenu connexe

Tendances

Introduction to Basic Java Versions and their features
Introduction to Basic Java Versions and their featuresIntroduction to Basic Java Versions and their features
Introduction to Basic Java Versions and their featuresAkash Badone
 
Quarkus - a next-generation Kubernetes Native Java framework
Quarkus - a next-generation Kubernetes Native Java frameworkQuarkus - a next-generation Kubernetes Native Java framework
Quarkus - a next-generation Kubernetes Native Java frameworkSVDevOps
 
JUnit & Mockito, first steps
JUnit & Mockito, first stepsJUnit & Mockito, first steps
JUnit & Mockito, first stepsRenato Primavera
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation ToolIzzet Mustafaiev
 
Making The Move To Java 17 (JConf 2022)
Making The Move To Java 17 (JConf 2022)Making The Move To Java 17 (JConf 2022)
Making The Move To Java 17 (JConf 2022)Alex Motley
 
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVMRyan Cuprak
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Mr. Akaash
 
Interview preparation full_stack_java
Interview preparation full_stack_javaInterview preparation full_stack_java
Interview preparation full_stack_javaMallikarjuna G D
 
Memory Management in the Java Virtual Machine(Garbage collection)
Memory Management in the Java Virtual Machine(Garbage collection)Memory Management in the Java Virtual Machine(Garbage collection)
Memory Management in the Java Virtual Machine(Garbage collection)Prashanth Kumar
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootJosué Neis
 

Tendances (20)

Spring Boot
Spring BootSpring Boot
Spring Boot
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Spring boot
Spring bootSpring boot
Spring boot
 
Introduction to Basic Java Versions and their features
Introduction to Basic Java Versions and their featuresIntroduction to Basic Java Versions and their features
Introduction to Basic Java Versions and their features
 
Quarkus - a next-generation Kubernetes Native Java framework
Quarkus - a next-generation Kubernetes Native Java frameworkQuarkus - a next-generation Kubernetes Native Java framework
Quarkus - a next-generation Kubernetes Native Java framework
 
Core java
Core javaCore java
Core java
 
JUnit & Mockito, first steps
JUnit & Mockito, first stepsJUnit & Mockito, first steps
JUnit & Mockito, first steps
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Making The Move To Java 17 (JConf 2022)
Making The Move To Java 17 (JConf 2022)Making The Move To Java 17 (JConf 2022)
Making The Move To Java 17 (JConf 2022)
 
What's new in Java 11
What's new in Java 11What's new in Java 11
What's new in Java 11
 
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVM
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...
 
Arrays in Java
Arrays in Java Arrays in Java
Arrays in Java
 
Java Spring
Java SpringJava Spring
Java Spring
 
Interview preparation full_stack_java
Interview preparation full_stack_javaInterview preparation full_stack_java
Interview preparation full_stack_java
 
Memory Management in the Java Virtual Machine(Garbage collection)
Memory Management in the Java Virtual Machine(Garbage collection)Memory Management in the Java Virtual Machine(Garbage collection)
Memory Management in the Java Virtual Machine(Garbage collection)
 
Core java
Core java Core java
Core java
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 

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

Java 9-10 What's New
Java 9-10 What's NewJava 9-10 What's New
Java 9-10 What's NewNicola Pedot
 
Java 9 - Part1: New Features (Not Jigsaw Modules)
Java 9 - Part1: New Features (Not Jigsaw Modules)Java 9 - Part1: New Features (Not Jigsaw Modules)
Java 9 - Part1: New Features (Not Jigsaw Modules)Simone Bordet
 
QConSP 2018 - Java Module System
QConSP 2018 - Java Module SystemQConSP 2018 - Java Module System
QConSP 2018 - Java Module SystemLeonardo Zanivan
 
Prepare for JDK 9
Prepare for JDK 9Prepare for JDK 9
Prepare for JDK 9haochenglee
 
Using FXML on Clojure
Using FXML on ClojureUsing FXML on Clojure
Using FXML on ClojureEunPyoung Kim
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScriptJorg Janke
 
Java and OpenJDK: disecting the ecosystem
Java and OpenJDK: disecting the ecosystemJava and OpenJDK: disecting the ecosystem
Java and OpenJDK: disecting the ecosystemRafael Winterhalter
 
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Vadym Kazulkin
 
Java SE 9 modules - an introduction (July 2018)
Java SE 9 modules - an introduction (July 2018)Java SE 9 modules - an introduction (July 2018)
Java SE 9 modules - an introduction (July 2018)Stephen Colebourne
 
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been ToldDCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been ToldDocker, Inc.
 
Jigsaw - Javaforum 2015Q4
Jigsaw - Javaforum 2015Q4Jigsaw - Javaforum 2015Q4
Jigsaw - Javaforum 2015Q4Rikard Thulin
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers WorkshopJody Garnett
 
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...ddrschiw
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVMSylvain Wallez
 
Javascript training sample
Javascript training sampleJavascript training sample
Javascript training sampleprahalad_das_in
 
Whats new in Java 9,10,11,12
Whats new in Java 9,10,11,12Whats new in Java 9,10,11,12
Whats new in Java 9,10,11,12Rory Preddy
 

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

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

Plus de Simone Bordet

Java 9 - Part 2: Jigsaw Modules
Java 9 - Part 2: Jigsaw ModulesJava 9 - Part 2: Jigsaw Modules
Java 9 - Part 2: Jigsaw ModulesSimone Bordet
 
G1 Garbage Collector: Details and Tuning
G1 Garbage Collector: Details and TuningG1 Garbage Collector: Details and Tuning
G1 Garbage Collector: Details and TuningSimone Bordet
 
Servlet 3.1 Async I/O
Servlet 3.1 Async I/OServlet 3.1 Async I/O
Servlet 3.1 Async I/OSimone Bordet
 
HTTP/2 and Java: Current Status
HTTP/2 and Java: Current StatusHTTP/2 and Java: Current Status
HTTP/2 and Java: Current StatusSimone Bordet
 
Cloud-Ready Web Messaging with CometD
Cloud-Ready Web Messaging with CometDCloud-Ready Web Messaging with CometD
Cloud-Ready Web Messaging with CometDSimone Bordet
 

Plus de Simone Bordet (6)

Java 13 Updates
Java 13 UpdatesJava 13 Updates
Java 13 Updates
 
Java 9 - Part 2: Jigsaw Modules
Java 9 - Part 2: Jigsaw ModulesJava 9 - Part 2: Jigsaw Modules
Java 9 - Part 2: Jigsaw Modules
 
G1 Garbage Collector: Details and Tuning
G1 Garbage Collector: Details and TuningG1 Garbage Collector: Details and Tuning
G1 Garbage Collector: Details and Tuning
 
Servlet 3.1 Async I/O
Servlet 3.1 Async I/OServlet 3.1 Async I/O
Servlet 3.1 Async I/O
 
HTTP/2 and Java: Current Status
HTTP/2 and Java: Current StatusHTTP/2 and Java: Current Status
HTTP/2 and Java: Current Status
 
Cloud-Ready Web Messaging with CometD
Cloud-Ready Web Messaging with CometDCloud-Ready Web Messaging with CometD
Cloud-Ready Web Messaging with CometD
 

Dernier

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 

Dernier (20)

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 

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!