SlideShare a Scribd company logo
Highlights from Java 10 and 11
and Future of Java
by Vadym Kazulkin, ip.labs GmbH
Contact
Vadym Kazulkin, ip.labs GmbH
v.kazulkin@gmail.com
www.xing.com/profile/Vadym_Kazulkin
@VKazulkin
ip.labs GmbH
Highlights from Java 10
JEP 286 (Project Amber)
Local-Variable Type Inference
var list = new ArrayList<String>(); // infers ArrayList<String>
var stream = list.stream(); // infers Stream<String>
strictly speaking
var list = new ArrayList<String>()
is the same as
ArrayList<String> list = new ArrayList<String>();
List<String> list = new ArrayList<String>();
is the same as
var list = (List<String>) new ArrayList<String>()
JEP 307
Parallel Full GC for G1
Goal:
● Improve G1 worst-case latencies (when the concurrent collections can't
reclaim memory fast enough) by making the full GC parallel.
JEP 304
Garbage Collector Interface
Goals:
● Better modularity for HotSpot internal GC code
● Make it simpler to add a new GC to HotSpot without perturbing the current
code base
● Make it easier to exclude a GC from a JDK build
JEP 317
Experimental Java-Based JIT Compiler
Graal, a Java-based JIT compiler on the Linux/x64 platform, is the basis of the
experimental Ahead-of-Time (AOT) compiler introduced in JDK 9.
To Enable:
-XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
Miscellanious API Changes
Better container-awareness
● Before later versions of Java 8
– Runtime.getRuntime().availableProcessors() -> retrieves value from sysconf, means the total
number of processors for VM
– Runtime.getRuntime().maxMemory() -> gets the value for VM overall memory
● Java 9 is container-aware automatically detecting cpusets
JVM considers cgroups memory limits if the following flags are specified:
– -XX:+UseCGroupMemoryLimitForHeap
– -XX:+UnlockExperimentalVMOptions
– Max Heap space will be automatically set (if not overwritten) to the limit specified by the cgroup
Miscellanious API Changes
Better container-awareness
● For “fixing” CPU shares in Java 9 overwrite
– -XMX for memory
– -XX:ParallelGCThreads and -XX:ConcGCThreads for CPU
– -System property java.util.concurrent.ForkJoinPool.common.parallelism for ForkJoinPool
● Better container-awareness in Java 10 (CPU shares support is included)
– Runtime.getRuntime().availableProcessors()
– Runtime.getRuntime().maxMemory()
Sources: „Java SE 9 support for Docker CPU and memory limits“https://blogs.oracle.com/java-platform-group/java-se-support-for-
docker-cpu-and-memory-limits
„ Nobody puts Java in a container” https://jaxenter.com/nobody-puts-java-container-139373.html
„Improve docker container detection and resource configuration usage” https://bugs.openjdk.java.net/browse/JDK-8146115
„ Better containerized JVMs in JDK 10” https://jaxenter.com/better-containerized-jvms-jdk-10-140593.html
Miscellanious API Changes
● java.util.List, Set, Map.copyOf(Collection)
● java.util.stream.Collectors.toUnmodifiableList/Set/Map(Stream)
● Optional.orElseThrow()
Highlights from Java 11
Long-Term Support
Sources: https://jaxenter.de/jdk-support-sag-mal-70294 & Azul Systems
https://www.oracle.com/corporate/pressrelease/java-se-subscription-offering-062118.html
https://www.infoq.com/news/2018/06/new-support-pricing-java
Extended Oracle Public Java SE 8 Support
Source: http://www.oracle.com/technetwork/java/javase/tech/eol-135779.html
AdoptOpenJDK
Source: https://adoptopenjdk.net/
JEP 323 (Project Amber)
Local-Variable Syntax for Lambda Parameters
● (x, y) -> x.process(y) // implicitly typed lambda expression
● (var x, var y) -> x.process(y) // implicit typed lambda expression
● (@NonNull var x, @NonNull var y) -> x.process(y)
JEP 318
Epsilon: A No-Op Garbage Collector
Goals:
● Provide a completely passive GC implementation with a bounded
allocation limit and the lowest latency overhead possible, at the expense of
memory footprint and memory throughput
● Measure performance of other GCs
JEP 321
HTTP Client
Goals:
● Standardize the incubated HTTP Client API introduced in JDK 9, via JEP
110, and updated in JDK 10
● HTTP 2.0 Support
JEP 332
Transport Layer Security 1.3
Goal:
● Implement version 1.3 of the Transport Layer Security (TLS) Protocol
Miscellanious API Changes
● File.isSameContents() in addition to File.isSameFile()
● New methods and behaviour on the Java String class
– trim() method : uses the definition of space as any codepoint that is less than or equal to the
space character codepoint (u0040.)
– String.lines() and String.strip() also use this definition
– isBlank() : true if the string is empty or contains only white space
– stripLeading(), stripTrailing() : removal of Unicode white space from the beginning/end
Sources: https://bugs.openjdk.java.net/browse/JDK-8202285
https://www.javacodegeeks.com/2018/05/new-jdk-11-files-method-issamecontent.html
Future of Java
Beyond Java 11
Project Amber
Simplifying syntax (continuing)
Source: http://openjdk.java.net/projects/amber/
JEP 305
Pattern Matching
int numberOfLetters;
switch(season) {
case FALL:
numberOfLetters=4;
break;
case WINTER:
case SPRING:
case SUMMER:
numberOfLetters=6;
break;
default:
throw new IllegalStateException(„unknown season “+season);
}
JEP 305
Pattern Matching
int numberOfLetters =switch(season) {
case FALL -> 4;
case WINTER, SPRING, SUMMER -> 6;
default -> throw new IllegalStateException(„unknown season “+season);
};
JEP 305
Pattern Matching
String formatted = "unknown";
if (obj instanceof Integer) {
int i = (Integer) obj;
formatted = String.format("int %d", i);
} else if (obj instanceof Byte) {
byte b = (Byte) obj;
formatted = String.format("byte %d", b);
} else if (obj instanceof Long) {
long l = (Long) obj;
formatted = String.format("long %d", l);
} else if (obj instanceof Double) {
double d = (Double) obj;
formatted = String.format(“double %f", d);
} else if (obj instanceof String) {
String s = (String) obj;
formatted = String.format("String %s", s); }
JEP 305
Pattern Matching
String formatted;
switch (obj) {
case Integer i: formatted = String.format("int %d", i);
break;
case Byte b: formatted = String.format("byte %d", b);
break;
case Long l: formatted = String.format("long %d", l);
break;
case Double d: formatted = String.format(“double %f", d);
break;
case String s: formatted = String.format("String %s", s);
break;
default: formatted = obj.toString();
}
Project Valhalla
Value types and specialised generics
Source: http://openjdk.java.net/projects/valhalla/
Project Valhalla
Value Object
Value Object is an immutable type that is distinguishable only
by the state of its properties
Project Valhalla
Source: https://dzone.com/articles/what-is-project-valhalla
Project Valhalla
Benefits:
● Reduced memory usage
● Reduced indirection
● Increased locality
Codes like a class, works like a primitive (Brian Goetz)
Project Valhalla
Value Types
value class Point {long x, y ;}
Project Valhalla
Value Types
Can
● have method and field
● implement interfaces
● use encapsulation
● be generic
Can’t
● be muted
● be sub-classed
Project Valhalla
Specialized Generics
List<Long> points= new ArrayList<Long>();
List<Point> points= new ArrayList<Point>();
class Box<any T> { T value; }
class Box{T=Long} { Long value; }
class Box{T=Point} { Point value; }
Source: John Rose: http://cr.openjdk.java.net/~jrose/values/value-type-hygiene.html
Project Metropolis
Polyglot GraalVM (current version 1.0-rc3)
Source: http://openjdk.java.net/projects/metropolis
Project Metropolis
Goals:
● High performance for all languages
● Zero overhead interoperability between languages
● Language-level virtualization level for shared tooling
Source: Oleg Selajev : “Run Code in Any Language Anywhere with GraalVM” https://www.youtube.com/watch?v=JoDOo4FyYMU
GraalVM
Architecture
Sources: Practical Partial Evaluation for High-Performance Dynamic Language Runtimes
http://chrisseaton.com/rubytruffle/pldi17-truffle/pldi17-truffle.pdf
„The LLVM Compiler Infrastructure“ https://llvm.org/
Project Sulong
Source: Thomas Würthinger : “One VM to Rule Them All” https://www.youtube.com/watch?v=mMmOntDWSgw
GraalVM
Polyglot Server Example
Source: https://www.graalvm.org/docs/examples/polyglot-javascript-java-r/
JavaScript
Java
R
JavaScript
GraalVM
Performance
Source: Oleg Selajev : “Run Code in Any Language Anywhere with GraalVM” https://www.youtube.com/watch?v=JoDOo4FyYMU
GraalVM
Architecture
Sources: Practical Partial Evaluation for High-Performance Dynamic Language Runtimes
http://chrisseaton.com/rubytruffle/pldi17-truffle/pldi17-truffle.pdf
„The LLVM Compiler Infrastructure“ https://llvm.org/
SubstrateVM
Source: Christian Wimmer : “Polyglot Native: Java, Scala, Kotlin, and JVM languages” https://www.youtube.com/watch?v=5BMHIeMXTqA
SubstrateVM
Source: Oleg Selajev : “Run Code in Any Language Anywhere with GraalVM” https://www.youtube.com/watch?v=JoDOo4FyYMU
Difference Between Substrate VM & JVM Models
Source: Kevin Menard : “Improving TruffleRuby’s Startup Time with the SubstrateVM” https://www.youtube.com/watch?v=hIMldcAzd5o
GraalVM on SubstrateVM
A game changer for Java & Serverless?
Cold Start :
Source: Ajay Nair „Become a Serverless Black Belt” https://www.youtube.com/watch?v=oQFORsso2go
AWS Lambda cold start time
by supported language
Source: Yan Cui: https://read.acloud.guru/does-coding-language-memory-or-package-size-affect-cold-starts-of-aws-lambda-a15e26d12c76
GraalVM on SubstrateVM
A game changer for Java & Serverless?
Java Function compiled into a native executable using GraalVM on
SubstrateVM reduces
● “cold start” times
● memory footprint
by order of magnitude compared to running on JVM.
Project Loom
Fibers and Continuations
Source: http://openjdk.java.net/projects/loom
Project Loom
Goals:
● explore and incubate Java VM features and APIs built on top of them for
the implementation of lightweight user-mode threads (fibers), delimited
continuations
Project Loom
Fibers
Fibre is a thread scheduled not by the OS, but by the Runtime
Project Loom
Fibers
2 options how to implement:
● Thread (Runnable, ThreadSchedular)
● Strand (abstract thread)
Fiber Thread
Source: Talk „Project Loom: Fibers and Continuations for the Java Virtual Machine“ by Ron Pressler
https://www.youtube.com/watch?v=fpyub8fbrVE
Project Loom
Strand API
Project Loom
Continuation
Continuation is a program object, representing a computation
that may be suspended and resumed
Project Loom
Continuations
foo() { // (2)
...
bar()
...
}​
bar() {
...
Continuation.yield() // suspend (3)
... // (5)
}
main() {
Continutation c = new Continuation(foo) // (0)
c.continue() // (1)
c.continue() // (4)
}
Sources: Proposal by Ron Pressler: http://cr.openjdk.java.net/~rpressler/loom/Loom-Proposal.html and
Parallel Universe Quasar Project http://docs.paralleluniverse.co/quasar/
Project Loom
Continuations
Thread
=
Continuation + Schedular
Project Loom
Fibers Use Cases
● Fibers are serializable
– fibers can be sent via network
– advantages when calling external APIs in serverless environment
– shutdown container after sending request, startup after the response arrived and save money
(pause-resume functionality is currently missing for serverless)
● Retriable exceptions
Projects Panama
Goal:
● improve and enrich the connections between the JVM and well-defined non-Java
APIs, including many interfaces commonly used by C programmers
Sources: http://openjdk.java.net/projects/panama
Talk by Jim Laskey: “Native Script Engine or Go Panama” https://www.youtube.com/watch?v=-JLhwsbMvjQ
Project Shenandoah
Goals :
● ultra-low pause time garbage collector that reduces GC pause times by
performing more garbage collection work concurrently with the running Java
program
● CMS and G1 both perform concurrent marking of live objects. Shenandoah adds
concurrent compaction
Sources: http://openjdk.java.net/projects/shenandoah
Talk by Alexey Shipilev: “Shenandoah: The Garbage Collector That Could” https://www.youtube.com/watch?v=VCeHkcwfF9Q
is still an interesting and great
programming language
Questions?
www.iplabs.de
Thank You!

More Related Content

PDF
What you need to remember when you upload to CPAN
PPT
typemap in Perl/XS
PPTX
Jersey framework
PDF
Oredev 2015 - Taming Java Agents
PDF
Con-FESS 2015 - Having Fun With Javassist
PPTX
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
PDF
Voxxed Days Vilnius 2015 - Having fun with Javassist
PDF
How to inspect a RUNNING perl process
What you need to remember when you upload to CPAN
typemap in Perl/XS
Jersey framework
Oredev 2015 - Taming Java Agents
Con-FESS 2015 - Having Fun With Javassist
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
Voxxed Days Vilnius 2015 - Having fun with Javassist
How to inspect a RUNNING perl process

What's hot (20)

PDF
"Swoole: double troubles in c", Alexandr Vronskiy
PDF
Puppet Continuous Integration with PE and GitLab
PDF
Foomo / Zugspitze Presentation
PDF
Inside the JVM - Follow the white rabbit!
PDF
Highlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
PPTX
Jdk 7 4-forkjoin
PDF
JavaOne 2015 - Having fun with Javassist
PDF
The Parenscript Common Lisp to JavaScript compiler
PDF
Riga Dev Day 2016 - Having fun with Javassist
PDF
JRuby and You
PDF
Information security programming in ruby
PDF
Gradle in a Polyglot World
PDF
parenscript-tutorial
PPTX
Jdk(java) 7 - 6 기타기능
KEY
PyCon AU 2012 - Debugging Live Python Web Applications
PDF
Ruby HTTP clients comparison
PDF
Debugging concurrency programs in go
KEY
Intro to PSGI and Plack
PDF
[2C1] 아파치 피그를 위한 테즈 연산 엔진 개발하기 최종
PDF
Functional Reactive Programming on Android
"Swoole: double troubles in c", Alexandr Vronskiy
Puppet Continuous Integration with PE and GitLab
Foomo / Zugspitze Presentation
Inside the JVM - Follow the white rabbit!
Highlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
Jdk 7 4-forkjoin
JavaOne 2015 - Having fun with Javassist
The Parenscript Common Lisp to JavaScript compiler
Riga Dev Day 2016 - Having fun with Javassist
JRuby and You
Information security programming in ruby
Gradle in a Polyglot World
parenscript-tutorial
Jdk(java) 7 - 6 기타기능
PyCon AU 2012 - Debugging Live Python Web Applications
Ruby HTTP clients comparison
Debugging concurrency programs in go
Intro to PSGI and Plack
[2C1] 아파치 피그를 위한 테즈 연산 엔진 개발하기 최종
Functional Reactive Programming on Android
Ad

Similar to "Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 by Vadym Kazulkin (20)

PDF
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
PPTX
DevNexus 2020: Discover Modern Java
PDF
Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...
PDF
XML-Free Programming : Java Server and Client Development without &lt;>
PDF
Automatically generating-json-from-java-objects-java-objects268
PDF
Java features. Java 8, 9, 10, 11
PDF
De Java 8 a Java 11 y 14
PDF
Json generation
PPTX
Java 7 Whats New(), Whats Next() from Oredev
PDF
FFM / Panama: A case study with OpenSSL and Tomcat
PDF
PDF
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
PDF
Xanadu - Java Chapter Meeting
PPT
Tech Days 2010
PDF
De Java 8 ate Java 14
PDF
Java 8 Overview
PDF
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
PDF
Plugin-based software design with Ruby and RubyGems
PDF
Shared Memory Performance: Beyond TCP/IP with Ben Cotton, JPMorgan
PDF
Aop clustering
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
DevNexus 2020: Discover Modern Java
Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...
XML-Free Programming : Java Server and Client Development without &lt;>
Automatically generating-json-from-java-objects-java-objects268
Java features. Java 8, 9, 10, 11
De Java 8 a Java 11 y 14
Json generation
Java 7 Whats New(), Whats Next() from Oredev
FFM / Panama: A case study with OpenSSL and Tomcat
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Xanadu - Java Chapter Meeting
Tech Days 2010
De Java 8 ate Java 14
Java 8 Overview
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Plugin-based software design with Ruby and RubyGems
Shared Memory Performance: Beyond TCP/IP with Ben Cotton, JPMorgan
Aop clustering
Ad

More from Vadym Kazulkin (20)

PDF
How to develop, run and optimize Spring Boot 3 application on AWS Lambda - Wa...
PDF
Event-driven architecture patterns in highly scalable image storage solution-...
PDF
High performance Serverless Java on AWS- Serverless Architecture Javaland 2025
PDF
How to develop, run and optimize Spring Boot 3 application on AWS Lambda-OBI ...
PPTX
Making sense of AWS Serverless operations- AWS User Group Nuremberg
PDF
How to develop, run and optimize Spring Boot 3 application on AWS Lambda at V...
PPTX
Making sense of AWS Serverless operations at Believe in Serverless community ...
PDF
How to develop, run and optimize Spring Boot 3 application on AWS Lambda at I...
PDF
Making sense of AWS Serverless operations - Amarathon Geek China 2024
PDF
Event-driven architecture patterns in highly scalable image storage solution-...
PDF
High performance Serverless Java on AWS- Serverless Meetup Toronto
PDF
High performance Serverless Java on AWS- Serverless Architecture Conference B...
PDF
Making sense of AWS Serverless operations- Serverless Architecture Conference...
PDF
Detect operational anomalies in Serverless Applications with Amazon DevOps Gu...
PDF
Detect operational anomalies in Serverless Applications with Amazon DevOps Gu...
PDF
High performance Serverless Java on AWS- AWS Community Day Budapest 2024
PDF
Making sense of AWS Serverless operations AWS Community Day NL 2024-
PDF
Event-driven architecture patterns in highly scalable image storage solution ...
PDF
Detect operational anomalies in Serverless Applications with Amazon DevOps Gu...
PDF
High performance Serverless Java on AWS at We Are Developers 2024
How to develop, run and optimize Spring Boot 3 application on AWS Lambda - Wa...
Event-driven architecture patterns in highly scalable image storage solution-...
High performance Serverless Java on AWS- Serverless Architecture Javaland 2025
How to develop, run and optimize Spring Boot 3 application on AWS Lambda-OBI ...
Making sense of AWS Serverless operations- AWS User Group Nuremberg
How to develop, run and optimize Spring Boot 3 application on AWS Lambda at V...
Making sense of AWS Serverless operations at Believe in Serverless community ...
How to develop, run and optimize Spring Boot 3 application on AWS Lambda at I...
Making sense of AWS Serverless operations - Amarathon Geek China 2024
Event-driven architecture patterns in highly scalable image storage solution-...
High performance Serverless Java on AWS- Serverless Meetup Toronto
High performance Serverless Java on AWS- Serverless Architecture Conference B...
Making sense of AWS Serverless operations- Serverless Architecture Conference...
Detect operational anomalies in Serverless Applications with Amazon DevOps Gu...
Detect operational anomalies in Serverless Applications with Amazon DevOps Gu...
High performance Serverless Java on AWS- AWS Community Day Budapest 2024
Making sense of AWS Serverless operations AWS Community Day NL 2024-
Event-driven architecture patterns in highly scalable image storage solution ...
Detect operational anomalies in Serverless Applications with Amazon DevOps Gu...
High performance Serverless Java on AWS at We Are Developers 2024

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Cloud computing and distributed systems.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Review of recent advances in non-invasive hemoglobin estimation
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
NewMind AI Weekly Chronicles - August'25 Week I
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation_ Review paper, used for researhc scholars
Cloud computing and distributed systems.
20250228 LYD VKU AI Blended-Learning.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Chapter 3 Spatial Domain Image Processing.pdf
sap open course for s4hana steps from ECC to s4
Review of recent advances in non-invasive hemoglobin estimation
The AUB Centre for AI in Media Proposal.docx
MYSQL Presentation for SQL database connectivity
The Rise and Fall of 3GPP – Time for a Sabbatical?
Digital-Transformation-Roadmap-for-Companies.pptx
Electronic commerce courselecture one. Pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Advanced methodologies resolving dimensionality complications for autism neur...
Understanding_Digital_Forensics_Presentation.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
NewMind AI Weekly Chronicles - August'25 Week I

"Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 by Vadym Kazulkin

  • 1. Highlights from Java 10 and 11 and Future of Java by Vadym Kazulkin, ip.labs GmbH
  • 2. Contact Vadym Kazulkin, ip.labs GmbH v.kazulkin@gmail.com www.xing.com/profile/Vadym_Kazulkin @VKazulkin
  • 5. JEP 286 (Project Amber) Local-Variable Type Inference var list = new ArrayList<String>(); // infers ArrayList<String> var stream = list.stream(); // infers Stream<String> strictly speaking var list = new ArrayList<String>() is the same as ArrayList<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>(); is the same as var list = (List<String>) new ArrayList<String>()
  • 6. JEP 307 Parallel Full GC for G1 Goal: ● Improve G1 worst-case latencies (when the concurrent collections can't reclaim memory fast enough) by making the full GC parallel.
  • 7. JEP 304 Garbage Collector Interface Goals: ● Better modularity for HotSpot internal GC code ● Make it simpler to add a new GC to HotSpot without perturbing the current code base ● Make it easier to exclude a GC from a JDK build
  • 8. JEP 317 Experimental Java-Based JIT Compiler Graal, a Java-based JIT compiler on the Linux/x64 platform, is the basis of the experimental Ahead-of-Time (AOT) compiler introduced in JDK 9. To Enable: -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
  • 9. Miscellanious API Changes Better container-awareness ● Before later versions of Java 8 – Runtime.getRuntime().availableProcessors() -> retrieves value from sysconf, means the total number of processors for VM – Runtime.getRuntime().maxMemory() -> gets the value for VM overall memory ● Java 9 is container-aware automatically detecting cpusets JVM considers cgroups memory limits if the following flags are specified: – -XX:+UseCGroupMemoryLimitForHeap – -XX:+UnlockExperimentalVMOptions – Max Heap space will be automatically set (if not overwritten) to the limit specified by the cgroup
  • 10. Miscellanious API Changes Better container-awareness ● For “fixing” CPU shares in Java 9 overwrite – -XMX for memory – -XX:ParallelGCThreads and -XX:ConcGCThreads for CPU – -System property java.util.concurrent.ForkJoinPool.common.parallelism for ForkJoinPool ● Better container-awareness in Java 10 (CPU shares support is included) – Runtime.getRuntime().availableProcessors() – Runtime.getRuntime().maxMemory() Sources: „Java SE 9 support for Docker CPU and memory limits“https://blogs.oracle.com/java-platform-group/java-se-support-for- docker-cpu-and-memory-limits „ Nobody puts Java in a container” https://jaxenter.com/nobody-puts-java-container-139373.html „Improve docker container detection and resource configuration usage” https://bugs.openjdk.java.net/browse/JDK-8146115 „ Better containerized JVMs in JDK 10” https://jaxenter.com/better-containerized-jvms-jdk-10-140593.html
  • 11. Miscellanious API Changes ● java.util.List, Set, Map.copyOf(Collection) ● java.util.stream.Collectors.toUnmodifiableList/Set/Map(Stream) ● Optional.orElseThrow()
  • 13. Long-Term Support Sources: https://jaxenter.de/jdk-support-sag-mal-70294 & Azul Systems https://www.oracle.com/corporate/pressrelease/java-se-subscription-offering-062118.html https://www.infoq.com/news/2018/06/new-support-pricing-java
  • 14. Extended Oracle Public Java SE 8 Support Source: http://www.oracle.com/technetwork/java/javase/tech/eol-135779.html
  • 16. JEP 323 (Project Amber) Local-Variable Syntax for Lambda Parameters ● (x, y) -> x.process(y) // implicitly typed lambda expression ● (var x, var y) -> x.process(y) // implicit typed lambda expression ● (@NonNull var x, @NonNull var y) -> x.process(y)
  • 17. JEP 318 Epsilon: A No-Op Garbage Collector Goals: ● Provide a completely passive GC implementation with a bounded allocation limit and the lowest latency overhead possible, at the expense of memory footprint and memory throughput ● Measure performance of other GCs
  • 18. JEP 321 HTTP Client Goals: ● Standardize the incubated HTTP Client API introduced in JDK 9, via JEP 110, and updated in JDK 10 ● HTTP 2.0 Support
  • 19. JEP 332 Transport Layer Security 1.3 Goal: ● Implement version 1.3 of the Transport Layer Security (TLS) Protocol
  • 20. Miscellanious API Changes ● File.isSameContents() in addition to File.isSameFile() ● New methods and behaviour on the Java String class – trim() method : uses the definition of space as any codepoint that is less than or equal to the space character codepoint (u0040.) – String.lines() and String.strip() also use this definition – isBlank() : true if the string is empty or contains only white space – stripLeading(), stripTrailing() : removal of Unicode white space from the beginning/end Sources: https://bugs.openjdk.java.net/browse/JDK-8202285 https://www.javacodegeeks.com/2018/05/new-jdk-11-files-method-issamecontent.html
  • 22. Project Amber Simplifying syntax (continuing) Source: http://openjdk.java.net/projects/amber/
  • 23. JEP 305 Pattern Matching int numberOfLetters; switch(season) { case FALL: numberOfLetters=4; break; case WINTER: case SPRING: case SUMMER: numberOfLetters=6; break; default: throw new IllegalStateException(„unknown season “+season); }
  • 24. JEP 305 Pattern Matching int numberOfLetters =switch(season) { case FALL -> 4; case WINTER, SPRING, SUMMER -> 6; default -> throw new IllegalStateException(„unknown season “+season); };
  • 25. JEP 305 Pattern Matching String formatted = "unknown"; if (obj instanceof Integer) { int i = (Integer) obj; formatted = String.format("int %d", i); } else if (obj instanceof Byte) { byte b = (Byte) obj; formatted = String.format("byte %d", b); } else if (obj instanceof Long) { long l = (Long) obj; formatted = String.format("long %d", l); } else if (obj instanceof Double) { double d = (Double) obj; formatted = String.format(“double %f", d); } else if (obj instanceof String) { String s = (String) obj; formatted = String.format("String %s", s); }
  • 26. JEP 305 Pattern Matching String formatted; switch (obj) { case Integer i: formatted = String.format("int %d", i); break; case Byte b: formatted = String.format("byte %d", b); break; case Long l: formatted = String.format("long %d", l); break; case Double d: formatted = String.format(“double %f", d); break; case String s: formatted = String.format("String %s", s); break; default: formatted = obj.toString(); }
  • 27. Project Valhalla Value types and specialised generics Source: http://openjdk.java.net/projects/valhalla/
  • 28. Project Valhalla Value Object Value Object is an immutable type that is distinguishable only by the state of its properties
  • 30. Project Valhalla Benefits: ● Reduced memory usage ● Reduced indirection ● Increased locality Codes like a class, works like a primitive (Brian Goetz)
  • 31. Project Valhalla Value Types value class Point {long x, y ;}
  • 32. Project Valhalla Value Types Can ● have method and field ● implement interfaces ● use encapsulation ● be generic Can’t ● be muted ● be sub-classed
  • 33. Project Valhalla Specialized Generics List<Long> points= new ArrayList<Long>(); List<Point> points= new ArrayList<Point>(); class Box<any T> { T value; } class Box{T=Long} { Long value; } class Box{T=Point} { Point value; } Source: John Rose: http://cr.openjdk.java.net/~jrose/values/value-type-hygiene.html
  • 34. Project Metropolis Polyglot GraalVM (current version 1.0-rc3) Source: http://openjdk.java.net/projects/metropolis
  • 35. Project Metropolis Goals: ● High performance for all languages ● Zero overhead interoperability between languages ● Language-level virtualization level for shared tooling Source: Oleg Selajev : “Run Code in Any Language Anywhere with GraalVM” https://www.youtube.com/watch?v=JoDOo4FyYMU
  • 36. GraalVM Architecture Sources: Practical Partial Evaluation for High-Performance Dynamic Language Runtimes http://chrisseaton.com/rubytruffle/pldi17-truffle/pldi17-truffle.pdf „The LLVM Compiler Infrastructure“ https://llvm.org/
  • 37. Project Sulong Source: Thomas Würthinger : “One VM to Rule Them All” https://www.youtube.com/watch?v=mMmOntDWSgw
  • 38. GraalVM Polyglot Server Example Source: https://www.graalvm.org/docs/examples/polyglot-javascript-java-r/ JavaScript Java R JavaScript
  • 39. GraalVM Performance Source: Oleg Selajev : “Run Code in Any Language Anywhere with GraalVM” https://www.youtube.com/watch?v=JoDOo4FyYMU
  • 40. GraalVM Architecture Sources: Practical Partial Evaluation for High-Performance Dynamic Language Runtimes http://chrisseaton.com/rubytruffle/pldi17-truffle/pldi17-truffle.pdf „The LLVM Compiler Infrastructure“ https://llvm.org/
  • 41. SubstrateVM Source: Christian Wimmer : “Polyglot Native: Java, Scala, Kotlin, and JVM languages” https://www.youtube.com/watch?v=5BMHIeMXTqA
  • 42. SubstrateVM Source: Oleg Selajev : “Run Code in Any Language Anywhere with GraalVM” https://www.youtube.com/watch?v=JoDOo4FyYMU
  • 43. Difference Between Substrate VM & JVM Models Source: Kevin Menard : “Improving TruffleRuby’s Startup Time with the SubstrateVM” https://www.youtube.com/watch?v=hIMldcAzd5o
  • 44. GraalVM on SubstrateVM A game changer for Java & Serverless? Cold Start : Source: Ajay Nair „Become a Serverless Black Belt” https://www.youtube.com/watch?v=oQFORsso2go
  • 45. AWS Lambda cold start time by supported language Source: Yan Cui: https://read.acloud.guru/does-coding-language-memory-or-package-size-affect-cold-starts-of-aws-lambda-a15e26d12c76
  • 46. GraalVM on SubstrateVM A game changer for Java & Serverless? Java Function compiled into a native executable using GraalVM on SubstrateVM reduces ● “cold start” times ● memory footprint by order of magnitude compared to running on JVM.
  • 47. Project Loom Fibers and Continuations Source: http://openjdk.java.net/projects/loom
  • 48. Project Loom Goals: ● explore and incubate Java VM features and APIs built on top of them for the implementation of lightweight user-mode threads (fibers), delimited continuations
  • 49. Project Loom Fibers Fibre is a thread scheduled not by the OS, but by the Runtime
  • 50. Project Loom Fibers 2 options how to implement: ● Thread (Runnable, ThreadSchedular) ● Strand (abstract thread) Fiber Thread Source: Talk „Project Loom: Fibers and Continuations for the Java Virtual Machine“ by Ron Pressler https://www.youtube.com/watch?v=fpyub8fbrVE
  • 52. Project Loom Continuation Continuation is a program object, representing a computation that may be suspended and resumed
  • 53. Project Loom Continuations foo() { // (2) ... bar() ... }​ bar() { ... Continuation.yield() // suspend (3) ... // (5) } main() { Continutation c = new Continuation(foo) // (0) c.continue() // (1) c.continue() // (4) } Sources: Proposal by Ron Pressler: http://cr.openjdk.java.net/~rpressler/loom/Loom-Proposal.html and Parallel Universe Quasar Project http://docs.paralleluniverse.co/quasar/
  • 55. Project Loom Fibers Use Cases ● Fibers are serializable – fibers can be sent via network – advantages when calling external APIs in serverless environment – shutdown container after sending request, startup after the response arrived and save money (pause-resume functionality is currently missing for serverless) ● Retriable exceptions
  • 56. Projects Panama Goal: ● improve and enrich the connections between the JVM and well-defined non-Java APIs, including many interfaces commonly used by C programmers Sources: http://openjdk.java.net/projects/panama Talk by Jim Laskey: “Native Script Engine or Go Panama” https://www.youtube.com/watch?v=-JLhwsbMvjQ
  • 57. Project Shenandoah Goals : ● ultra-low pause time garbage collector that reduces GC pause times by performing more garbage collection work concurrently with the running Java program ● CMS and G1 both perform concurrent marking of live objects. Shenandoah adds concurrent compaction Sources: http://openjdk.java.net/projects/shenandoah Talk by Alexey Shipilev: “Shenandoah: The Garbage Collector That Could” https://www.youtube.com/watch?v=VCeHkcwfF9Q
  • 58. is still an interesting and great programming language