SlideShare a Scribd company logo
Java >= 9
Modules, Containers and New Things You Can Do In Private
Outline
• Java 9
• Java 10
• Java 11
• Versioning
• LTS and Support
Java 9
ProcessHandle / ProcessHandle.Info
ProcessHandle self = ProcessHandle.current();
long pid = self.getPid();
ProcessHandle.Info info = self.info();
Optional<String[]> args = info.arguments();
Optional<String> cmd = info.commandLine();
Optional<Instant> started = info.startInstant();
Optional<Duration> cpu = info.totalCpuDuration();
ProcessHandle children()
Stream<ProcessHandle> children = ProcessHandle.current().children();
children.forEach(handle -> {
assertTrue("Could not kill process " + handle.getPid(), handle.destroy());
});
Interface Private Methods
interface IntrovertInterface {
private static String staticPrivate() { return ”personal”; }
private String instancePrivate() { return ”library”; }
default void invoke() {
String result = staticPrivate();
result += ” ”.concat(instancePrivate());
System.out.println(result);
}
}
Interfaces Now Allow
1. Constant variables
2. Abstract methods
3. Default methods
4. Static methods
5. Private methods
6. Private static methods
Updated try-with-resources
Now manage final or effectively final variables
Before:
try (PrintWriter writer = new PrintWriter(new File("test.txt"))) {
writer.println("Hello World”);
}
After:
PrintWriter writer = new PrintWriter(new File("test.txt"));
try(writer){
writer.println(“…”);
}
Diamond Operator Extension
Diamond Operator <> extended to Anonymous Inner Classes
WitnessClass<Integer> fc = new WitnessClass<>(1) {
// anonymous inner class impl
};
WitnessClass<? extends Integer> fc0 = new WitnessClass<>(1000) {
// anonymous inner class impl
};
WitnessClass<?> fc1 = new WitnessClass<>(“1”) {
// anonymous inner class impl
};
New APIs
• java.util.Set.of()
• Set<String> keys = Set.of("key1", "key2", "key3");
• java.util.Optional.stream()
• List<String> filteredList = listOfOptionals.stream()
.flatMap(Optional::stream)
.collect(Collectors.toList());
• java.awt.image.MultiResolutionImage
Tooling Changes
• JShell REPL
• JCMD updates
• jhat removed
• Multi-release jar files
• JVM hprof agent removed
• Javadoc HTML5 + Search
Other Enhancements
• Publish-Subscribe for Reactive Streams (java.util.concurrent.Flow)
• Unified JVM Logging
• Bonus Incubating Feature – new HTTP Client
• Stack Walking API
• Variable Handles
• In java.lang.invoke - VarHandle and MethodHandles. It provides equivalents
of java.util.concurrent.atomic and sun.misc.Unsafe operations on object fields
and array elements with similar performance. In Java 9 Modular system
sun.misc.Unsafe will not be possible from application code.
Modules
• One of the biggest changes to Java since Generics
• Even Javadoc got an overhaul because of Modules.
Note:
There are literally books on this topic.
• https://javamodularity.com/
• https://www.manning.com/books/the-java-module-system
The Goals of JSR-376 / Project Jigsaw
• Reliable configuration
• Strong encapsulation
• Scalable platform
• Greater platform integrity
• Improved performance
module-info.java
• Included in jar file at the root of the package hierarchy.
module <module_name> {
}
Keywords - requires
• requires <module_name> - allows access to public types exported
in the target module
• requires transitive <module_name> - any modules depending
on this module also depend on the transitive module
Keywords - exports
• exports <package_name> - makes public members in a package
available to be required.
• Qualified export – limits the module to which a package is made
available.
exports <package_name> to <module_name>
Keywords - uses / provides
• Service Provider Interface keywords.
• uses <class_name> - makes the current module a consumer of the
specified service class.
• provides <class_name> with <class_name_impl> -
identifies/registers a class which implements a service class
Keywords - opens / open
• opens <package_name> - allows reflection based access to all
members of a specified package.
• Qualified open – limits the module to which a package is made
opened.
opens <package_name> to <module_name>
• Open module - defines a module as previously shown but allows
runtime access to all packages via reflection
open module <module_name> …
Example Module
$ java --describe-module java.sql
java.sql@9.0.4
exports java.sql
exports javax.sql
exports javax.transaction.xa
requires java.logging transitive
requires java.base mandated
requires java.xml transitive
uses java.sql.Driver
The java.se module
jlink
• Make your own JRE
• Includes only the necessary components to run your application
• Default JRE size is 200+ MB
• Applications built with jlink can be much smaller
Some Caveats
• This is a (woefully incomplete) overview.
• Tooling Support is still being developed
• Gradle for example does not currently support building or jlinking modules
without the use of an incubating plugin.
• Existing libraries may require rework – e.g, repackaged jars.
• Module system is easily circumvented by using CLASSPATH instead of
MODULEPATH
Java 10
Local Variable Type Inference
• var keyword (but it’s not JavaScript)
• Before Java 7
• Map<String, List<String>> tagged = new HashMap<String,List<String>>();
• Java 7:
• Map<User, List<String>> tagged = new HashMap<>();
• Java 10
• var tagged = new HashMap<User, List<String>>();
Use Cases
• Does exactly what it says it does.
• Local variables only, in contexts where type can be inferred.
• You can’t do this:
• var x = null;
• var y;
• But you can do this:
• var list = new ArrayList<>();
• Inferred as ArrayList<Object> which is probably not what you want.
Better Containerized Behavior
• Memory
• Before - JVM defaults to 1/4th physical memory of the server.
• After - JVM reads memory limits from container cgroup.
• Similar issue with CPUs.
• JVMs assume they have greater access to resources.
• Especially if code uses Runtime.availableProcessors()
• Attach Protocol
• Before - not possible to attach from host to container JVM.
• After - container JVM finds its PID in the root namespace and uses that to
watch for JVM attachment.
Under the Hood
• Garbage Collector Interface (improve the modularity of various GC
implementations) (JEP 304)
• Parallel full GC for G1 (improve worst-case latencies with the default
collector) (JEP 307)
• Experimental Graal Java-based JIT compiler (can be enabled on Linux) (JEP
317)
• Remove the Native Header generation tool (javah) (JEP 313)
Under the Hood (cont)
• Root Certificates and Certification Authority (JEP 319)
• Thread-local Handshakes (Makes it both possible and cheap to stop
individual threads and not just all threads or none)(JEP 312)
• Heap Allocation on Alternative Memory Devices (JEP 316)
• Additional Unicode Language-Tag Extensions (JEP 314)
Java 11
What’s In Java 11
• Local Variable Syntax for Lambda Parameters (JEP 323)
• Allow var to be used to declare the formal parameters of an implicitly typed
lambda expression.
• Instead of
(var x, var y) -> x.process(y)
• We’ll be able to simply write:
(x, y) -> x.process(y)
What’s In Java 11
• Epsilon: A No-op Garbage Collector (JEP 318)
• Dynamic Class File Constants (JEP 309)
• "seek[s] to reduce the cost and disruption of creating new forms of
materializable class-file constants, which in turn offers language designers and
compiler implementors broader options for expressivity and performance."
What’s Not in Java 11
• Java EE and CORBA Modules
Here There Be Ranting …
Versioning
JDK Release Cadence
• Release every six months
• LTS Release every 3 years
• 8 is an LTS release
• 11 is an LTS release
• 17 will be the next LTS release in 2021
Version Identifiers
• Java 8 is 1.8
• Java 9 is 9.0
• Java 10 is 18.3*
• Java 11 is 18.9*
*Proposed versioning scheme (year.month)
Long Term Support
For varying definitions of Support
Public Updates
• Support for a release ends with the next release.
• Java 8 - No updates after Jan. 2019
• Java 9 - No updates after Mar. 2018 (Java 10 release date)
• Java 10 - No updates after Sept. 2018 (Java 11 release date)
• Java 11 - TBA
• should in theory end with the next LTS version 17 in 2021
• but only if you’re paying for support, otherwise, no updates after Java 12
Other Support Options
• https://www.azul.com/products/zulu-and-zulu-enterprise/
• https://adoptopenjdk.net/
Questions
Resources
• https://docs.oracle.com/javase/9/whatsnew/toc.htm
• https://www.pluralsight.com/blog/software-development/java-9-new-features
• https://blog.takipi.com/5-features-in-java-9-that-will-change-how-you-develop-software-and-2-that-wont/
• http://www.baeldung.com/new-java-9
• https://www.opsian.com/blog/java-on-docker/
• http://www.oracle.com/technetwork/java/javase/10-relnote-issues-4108729.html
• https://dzone.com/articles/java-10-new-features-and-enhancements
• https://blog.takipi.com/java-11-will-include-more-than-just-features/
• https://dzone.com/articles/an-early-look-at-features-targeted-for-java-11
• https://medium.com/@afinlay/java-11-sneak-peek-local-variable-type-inference-var-extended-to-lambda-expression-
parameters-e31e3338f1fe
• http://www.oracle.com/technetwork/java/javase/eol-135779.html
• https://jaxenter.com/end-life-comes-early-jdk-8-140824.html

More Related Content

What's hot

JVM
JVMJVM
Dynamic poly-preso
Dynamic poly-presoDynamic poly-preso
Dynamic poly-preso
Scott Shaw
 
Commons Pool and DBCP
Commons Pool and DBCPCommons Pool and DBCP
Commons Pool and DBCP
Phil Steitz
 
Lucene revolution 2011
Lucene revolution 2011Lucene revolution 2011
Lucene revolution 2011
Takahiko Ito
 
SCWCD : Thread safe servlets : CHAP : 8
SCWCD : Thread safe servlets : CHAP : 8SCWCD : Thread safe servlets : CHAP : 8
SCWCD : Thread safe servlets : CHAP : 8
Ben Abdallah Helmi
 
Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0
Scott Leberknight
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
EDB
 
JavaCro'14 - Unit testing in AngularJS – Slaven Tomac
JavaCro'14 - Unit testing in AngularJS – Slaven TomacJavaCro'14 - Unit testing in AngularJS – Slaven Tomac
JavaCro'14 - Unit testing in AngularJS – Slaven Tomac
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
scalaconfjp
 
Java New Evolution
Java New EvolutionJava New Evolution
Java New Evolution
Allan Huang
 
The CoFX Data Model
The CoFX Data ModelThe CoFX Data Model
The CoFX Data Model
Rainer Stropek
 
MongoDB 在盛大大数据量下的应用
MongoDB 在盛大大数据量下的应用MongoDB 在盛大大数据量下的应用
MongoDB 在盛大大数据量下的应用
iammutex
 
[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화
NAVER D2
 
HotSpotコトハジメ
HotSpotコトハジメHotSpotコトハジメ
HotSpotコトハジメ
Yasumasa Suenaga
 
Unit testing: unitils & dbmaintain
Unit testing: unitils & dbmaintainUnit testing: unitils & dbmaintain
Unit testing: unitils & dbmaintain
nevenfi
 
Java 8 Overview
Java 8 OverviewJava 8 Overview
Java 8 Overview
Nicola Pedot
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Marco Gralike
 
Drools
DroolsDrools
Drools
Allan Huang
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
Prashant Rane
 

What's hot (19)

JVM
JVMJVM
JVM
 
Dynamic poly-preso
Dynamic poly-presoDynamic poly-preso
Dynamic poly-preso
 
Commons Pool and DBCP
Commons Pool and DBCPCommons Pool and DBCP
Commons Pool and DBCP
 
Lucene revolution 2011
Lucene revolution 2011Lucene revolution 2011
Lucene revolution 2011
 
SCWCD : Thread safe servlets : CHAP : 8
SCWCD : Thread safe servlets : CHAP : 8SCWCD : Thread safe servlets : CHAP : 8
SCWCD : Thread safe servlets : CHAP : 8
 
Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
JavaCro'14 - Unit testing in AngularJS – Slaven Tomac
JavaCro'14 - Unit testing in AngularJS – Slaven TomacJavaCro'14 - Unit testing in AngularJS – Slaven Tomac
JavaCro'14 - Unit testing in AngularJS – Slaven Tomac
 
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
 
Java New Evolution
Java New EvolutionJava New Evolution
Java New Evolution
 
The CoFX Data Model
The CoFX Data ModelThe CoFX Data Model
The CoFX Data Model
 
MongoDB 在盛大大数据量下的应用
MongoDB 在盛大大数据量下的应用MongoDB 在盛大大数据量下的应用
MongoDB 在盛大大数据量下的应用
 
[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화
 
HotSpotコトハジメ
HotSpotコトハジメHotSpotコトハジメ
HotSpotコトハジメ
 
Unit testing: unitils & dbmaintain
Unit testing: unitils & dbmaintainUnit testing: unitils & dbmaintain
Unit testing: unitils & dbmaintain
 
Java 8 Overview
Java 8 OverviewJava 8 Overview
Java 8 Overview
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
 
Drools
DroolsDrools
Drools
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
 

Similar to Java >= 9

What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
Gal Marder
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9
Ivan Krylov
 
Java10 and Java11 at JJUG CCC 2018 Spr
Java10 and Java11 at JJUG CCC 2018 SprJava10 and Java11 at JJUG CCC 2018 Spr
Java10 and Java11 at JJUG CCC 2018 Spr
なおき きしだ
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
Arto Santala
 
Gradle
GradleGradle
GOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesGOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter Slides
Alexandra Masterson
 
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsIntroduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Emiel Paasschens
 
Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)
Robert Scholte
 
Java SE 8 - New Features
Java SE 8 - New FeaturesJava SE 8 - New Features
Java SE 8 - New Features
Naveen Hegde
 
Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?
Mario Camou Riveroll
 
Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)
Trisha Gee
 
Summary of JDK10 and What will come into JDK11
Summary of JDK10 and What will come into JDK11Summary of JDK10 and What will come into JDK11
Summary of JDK10 and What will come into JDK11
なおき きしだ
 
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Nayden Gochev
 
Java 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx FranceJava 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx France
Trisha Gee
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
Mattias Karlsson
 
Java 9 Features
Java 9 FeaturesJava 9 Features
Java 9 Features
NexThoughts Technologies
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
Martijn Verburg
 
Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)
Ryan Cuprak
 
What we can expect from Java 9 by Ivan Krylov
What we can expect from Java 9 by Ivan KrylovWhat we can expect from Java 9 by Ivan Krylov
What we can expect from Java 9 by Ivan Krylov
J On The Beach
 
Modules Building Presentation
Modules Building PresentationModules Building Presentation
Modules Building Presentation
htyson
 

Similar to Java >= 9 (20)

What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9
 
Java10 and Java11 at JJUG CCC 2018 Spr
Java10 and Java11 at JJUG CCC 2018 SprJava10 and Java11 at JJUG CCC 2018 Spr
Java10 and Java11 at JJUG CCC 2018 Spr
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
 
Gradle
GradleGradle
Gradle
 
GOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesGOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter Slides
 
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsIntroduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
 
Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)
 
Java SE 8 - New Features
Java SE 8 - New FeaturesJava SE 8 - New Features
Java SE 8 - New Features
 
Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?
 
Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)
 
Summary of JDK10 and What will come into JDK11
Summary of JDK10 and What will come into JDK11Summary of JDK10 and What will come into JDK11
Summary of JDK10 and What will come into JDK11
 
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
 
Java 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx FranceJava 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx France
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
Java 9 Features
Java 9 FeaturesJava 9 Features
Java 9 Features
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
 
Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)
 
What we can expect from Java 9 by Ivan Krylov
What we can expect from Java 9 by Ivan KrylovWhat we can expect from Java 9 by Ivan Krylov
What we can expect from Java 9 by Ivan Krylov
 
Modules Building Presentation
Modules Building PresentationModules Building Presentation
Modules Building Presentation
 

Recently uploaded

GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
Edge AI and Vision Alliance
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 

Recently uploaded (20)

GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
 
Artificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic WarfareArtificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic Warfare
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 

Java >= 9

  • 1. Java >= 9 Modules, Containers and New Things You Can Do In Private
  • 2. Outline • Java 9 • Java 10 • Java 11 • Versioning • LTS and Support
  • 4. ProcessHandle / ProcessHandle.Info ProcessHandle self = ProcessHandle.current(); long pid = self.getPid(); ProcessHandle.Info info = self.info(); Optional<String[]> args = info.arguments(); Optional<String> cmd = info.commandLine(); Optional<Instant> started = info.startInstant(); Optional<Duration> cpu = info.totalCpuDuration();
  • 5. ProcessHandle children() Stream<ProcessHandle> children = ProcessHandle.current().children(); children.forEach(handle -> { assertTrue("Could not kill process " + handle.getPid(), handle.destroy()); });
  • 6. Interface Private Methods interface IntrovertInterface { private static String staticPrivate() { return ”personal”; } private String instancePrivate() { return ”library”; } default void invoke() { String result = staticPrivate(); result += ” ”.concat(instancePrivate()); System.out.println(result); } }
  • 7. Interfaces Now Allow 1. Constant variables 2. Abstract methods 3. Default methods 4. Static methods 5. Private methods 6. Private static methods
  • 8. Updated try-with-resources Now manage final or effectively final variables Before: try (PrintWriter writer = new PrintWriter(new File("test.txt"))) { writer.println("Hello World”); } After: PrintWriter writer = new PrintWriter(new File("test.txt")); try(writer){ writer.println(“…”); }
  • 9. Diamond Operator Extension Diamond Operator <> extended to Anonymous Inner Classes WitnessClass<Integer> fc = new WitnessClass<>(1) { // anonymous inner class impl }; WitnessClass<? extends Integer> fc0 = new WitnessClass<>(1000) { // anonymous inner class impl }; WitnessClass<?> fc1 = new WitnessClass<>(“1”) { // anonymous inner class impl };
  • 10. New APIs • java.util.Set.of() • Set<String> keys = Set.of("key1", "key2", "key3"); • java.util.Optional.stream() • List<String> filteredList = listOfOptionals.stream() .flatMap(Optional::stream) .collect(Collectors.toList()); • java.awt.image.MultiResolutionImage
  • 11. Tooling Changes • JShell REPL • JCMD updates • jhat removed • Multi-release jar files • JVM hprof agent removed • Javadoc HTML5 + Search
  • 12. Other Enhancements • Publish-Subscribe for Reactive Streams (java.util.concurrent.Flow) • Unified JVM Logging • Bonus Incubating Feature – new HTTP Client • Stack Walking API • Variable Handles • In java.lang.invoke - VarHandle and MethodHandles. It provides equivalents of java.util.concurrent.atomic and sun.misc.Unsafe operations on object fields and array elements with similar performance. In Java 9 Modular system sun.misc.Unsafe will not be possible from application code.
  • 13. Modules • One of the biggest changes to Java since Generics • Even Javadoc got an overhaul because of Modules. Note: There are literally books on this topic. • https://javamodularity.com/ • https://www.manning.com/books/the-java-module-system
  • 14. The Goals of JSR-376 / Project Jigsaw • Reliable configuration • Strong encapsulation • Scalable platform • Greater platform integrity • Improved performance
  • 15. module-info.java • Included in jar file at the root of the package hierarchy. module <module_name> { }
  • 16. Keywords - requires • requires <module_name> - allows access to public types exported in the target module • requires transitive <module_name> - any modules depending on this module also depend on the transitive module
  • 17. Keywords - exports • exports <package_name> - makes public members in a package available to be required. • Qualified export – limits the module to which a package is made available. exports <package_name> to <module_name>
  • 18. Keywords - uses / provides • Service Provider Interface keywords. • uses <class_name> - makes the current module a consumer of the specified service class. • provides <class_name> with <class_name_impl> - identifies/registers a class which implements a service class
  • 19. Keywords - opens / open • opens <package_name> - allows reflection based access to all members of a specified package. • Qualified open – limits the module to which a package is made opened. opens <package_name> to <module_name> • Open module - defines a module as previously shown but allows runtime access to all packages via reflection open module <module_name> …
  • 20. Example Module $ java --describe-module java.sql java.sql@9.0.4 exports java.sql exports javax.sql exports javax.transaction.xa requires java.logging transitive requires java.base mandated requires java.xml transitive uses java.sql.Driver
  • 22. jlink • Make your own JRE • Includes only the necessary components to run your application • Default JRE size is 200+ MB • Applications built with jlink can be much smaller
  • 23. Some Caveats • This is a (woefully incomplete) overview. • Tooling Support is still being developed • Gradle for example does not currently support building or jlinking modules without the use of an incubating plugin. • Existing libraries may require rework – e.g, repackaged jars. • Module system is easily circumvented by using CLASSPATH instead of MODULEPATH
  • 25. Local Variable Type Inference • var keyword (but it’s not JavaScript) • Before Java 7 • Map<String, List<String>> tagged = new HashMap<String,List<String>>(); • Java 7: • Map<User, List<String>> tagged = new HashMap<>(); • Java 10 • var tagged = new HashMap<User, List<String>>();
  • 26. Use Cases • Does exactly what it says it does. • Local variables only, in contexts where type can be inferred. • You can’t do this: • var x = null; • var y; • But you can do this: • var list = new ArrayList<>(); • Inferred as ArrayList<Object> which is probably not what you want.
  • 27. Better Containerized Behavior • Memory • Before - JVM defaults to 1/4th physical memory of the server. • After - JVM reads memory limits from container cgroup. • Similar issue with CPUs. • JVMs assume they have greater access to resources. • Especially if code uses Runtime.availableProcessors() • Attach Protocol • Before - not possible to attach from host to container JVM. • After - container JVM finds its PID in the root namespace and uses that to watch for JVM attachment.
  • 28. Under the Hood • Garbage Collector Interface (improve the modularity of various GC implementations) (JEP 304) • Parallel full GC for G1 (improve worst-case latencies with the default collector) (JEP 307) • Experimental Graal Java-based JIT compiler (can be enabled on Linux) (JEP 317) • Remove the Native Header generation tool (javah) (JEP 313)
  • 29. Under the Hood (cont) • Root Certificates and Certification Authority (JEP 319) • Thread-local Handshakes (Makes it both possible and cheap to stop individual threads and not just all threads or none)(JEP 312) • Heap Allocation on Alternative Memory Devices (JEP 316) • Additional Unicode Language-Tag Extensions (JEP 314)
  • 31. What’s In Java 11 • Local Variable Syntax for Lambda Parameters (JEP 323) • Allow var to be used to declare the formal parameters of an implicitly typed lambda expression. • Instead of (var x, var y) -> x.process(y) • We’ll be able to simply write: (x, y) -> x.process(y)
  • 32. What’s In Java 11 • Epsilon: A No-op Garbage Collector (JEP 318) • Dynamic Class File Constants (JEP 309) • "seek[s] to reduce the cost and disruption of creating new forms of materializable class-file constants, which in turn offers language designers and compiler implementors broader options for expressivity and performance."
  • 33. What’s Not in Java 11 • Java EE and CORBA Modules
  • 34. Here There Be Ranting …
  • 36. JDK Release Cadence • Release every six months • LTS Release every 3 years • 8 is an LTS release • 11 is an LTS release • 17 will be the next LTS release in 2021
  • 37. Version Identifiers • Java 8 is 1.8 • Java 9 is 9.0 • Java 10 is 18.3* • Java 11 is 18.9* *Proposed versioning scheme (year.month)
  • 38. Long Term Support For varying definitions of Support
  • 39. Public Updates • Support for a release ends with the next release. • Java 8 - No updates after Jan. 2019 • Java 9 - No updates after Mar. 2018 (Java 10 release date) • Java 10 - No updates after Sept. 2018 (Java 11 release date) • Java 11 - TBA • should in theory end with the next LTS version 17 in 2021 • but only if you’re paying for support, otherwise, no updates after Java 12
  • 40. Other Support Options • https://www.azul.com/products/zulu-and-zulu-enterprise/ • https://adoptopenjdk.net/
  • 42. Resources • https://docs.oracle.com/javase/9/whatsnew/toc.htm • https://www.pluralsight.com/blog/software-development/java-9-new-features • https://blog.takipi.com/5-features-in-java-9-that-will-change-how-you-develop-software-and-2-that-wont/ • http://www.baeldung.com/new-java-9 • https://www.opsian.com/blog/java-on-docker/ • http://www.oracle.com/technetwork/java/javase/10-relnote-issues-4108729.html • https://dzone.com/articles/java-10-new-features-and-enhancements • https://blog.takipi.com/java-11-will-include-more-than-just-features/ • https://dzone.com/articles/an-early-look-at-features-targeted-for-java-11 • https://medium.com/@afinlay/java-11-sneak-peek-local-variable-type-inference-var-extended-to-lambda-expression- parameters-e31e3338f1fe • http://www.oracle.com/technetwork/java/javase/eol-135779.html • https://jaxenter.com/end-life-comes-early-jdk-8-140824.html