| JF James | © Worldline | Touraine Tech
A few words about me
2
Lille
Lyon
Blois Tours
Rennes
blog.worldline.tech
| JF James | © Worldline | Touraine Tech
A brief history of Java
4
1.0 1.1
1.2 1.3
1.4 5.0
6
7
8
JDK distribution size (compressed MB)
Release date (y)
| JF James | © Worldline | Touraine Tech 5 5
Refresher on Java SE 8
Released on 18 March 2014
Functional & asynchronous programming
New Date Time API
Streams
Method reference
Lambda expression
Optional CompletableFuture
Collectors
| JF James | © Worldline | Touraine Tech 6 6
Ready for Java 9?
More than 80 changes
Multi-release Jar file Reactive Streams API
| JF James | © Worldline | Touraine Tech
Expected benefits of the JDK modularity
7
Security
Maintenance
Scalability
Robustness Performance
Innovation
| JF James | © Worldline | Touraine Tech
The long story of Java Modularity
8
Started in 2005 (JSR 277), released in September 2017 (JSR 376)
| JF James | © Worldline | Touraine Tech
Discovering JPMS
Java native modular system
Makes modules explicit
Modularize the JDK itself
Open to Java Applications
9
Strong encapsulation by exporting or opening
packages
Explicit and reliable
dependencies
| JF James | © Worldline | Touraine Tech
How efficient is the JDK modularity?
11
0
5 000
10 000
15 000
20 000
25 000
30 000
35 000
With modularity
| JF James | © Worldline | Touraine Tech
Opening packages
12
module easytext.gui { opens easytext.gui to javafx.graphics; requires javax.graphics; }
import java.fx.Application; public class MyApp extends Application { public static void main(String … args) { Application.launch(args); } }
| JF James | © Worldline | Touraine Tech
Modular Java Services
13
Provider: module easytext.analysis.coleman { provides easytext.analysis.api.Analyser with easytext.analysis.coleman.ColemanAnalyser; }
Consumer: module easytext.analysis.client { uses easytext.analysis.api.Analyser; } … ServiceLoader.load(Analyzer.class);
| JF James | © Worldline | Touraine Tech
Welcome to the modulepath!
14
Modular JDK
Legacy App
Classpath-based
Modular App
Modulepath-based
Under your control
Out of your control
Already modular
Legacy Frameworks & libraries
Modular Frameworks & libraries
| JF James | © Worldline | Touraine Tech
On the road to application modularity
15
classpath modulepath
file.jar file.jar file.jar
module info
Legacy jar
Part of the unnamed module Everything exported & opened Can access everything (1)
--illegal-access allowed
Module name derived (2) or defined (3)
Everything exported & opened Can access everything (1)
–add-opens & add-exports allowed
Automatic module Explicit module
Explicit access to other modules Classpath unreadable
(1) From the classpath&modules (2) From the jar file name (3) Using Automatic-Module-Name (MANIFEST.MF)
| JF James | © Worldline | Touraine Tech
Naming modules
16
Use Automatic-Module-Name to define a stable name for library modules No version number in module name
| JF James | © Worldline | Touraine Tech 17 17
Just enough runtime with JLink
Creating custom "Java Images" for your applications
| JF James | © Worldline | Touraine Tech
Oracle new strategy
18
• The Reference Implementation • Including previous commercial features • Pure Open Source • GPL V2 + Class Path extension • Free of use and distribution • Time-driven release model
• 100% OpenJDK based • Commercial offering • Long Term Support
| JF James | © Worldline | Touraine Tech
Make Java innovative again!
19
2017 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
OpenJDK 9
2018 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Feature OpenJDK 10.0 11.0
Update OpenJDK 10.0.1 10.0.2 11.0.1
LTS Oracle JDK 11.0 LTS
2019 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Feature OpenJDK 12.0 13.0
Update OpenJDK 11.0.2 12.0.1 12.0.2 13.0.1
LTS Oracle JDK
2020 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Feature OpenJDK 14.0 15.0
Update OpenJDK 13.0.2 14.0.1 14.0.2 15.0.1
LTS Oracle JDK
Eof JDK8
Eof JDK8
| JF James | © Worldline | Touraine Tech
Challenges ahead of us
• Should I run my App on Java 9?
– Better performance expected (to be tested)
– Some adaptations needed: command lines, code (minor impact)
– Warning: G1 optimal for heap size >=4GB
• Should I use feature-releases or LTS?
– Eof Oracle JDK 9 support in Jan. 2019
– Feature-releases free of charge, more suited for short lifecycle App with Continuous Deployment in place
– Conversely LTS suited for long lifecycle App
20
2018
2018-2019
| JF James | © Worldline | Touraine Tech
Challenges ahead of us
• Should I modularize my App?
– Probably no for most legacy Applications
– To be assessed for existing Applications with long-term perspective
– Yes for new applications
– Dev and build tools will help
• Should I deliver a JLink-based custom runtime image in production?
– Probably yes to make the most of modular Applications
– JLink can be part the build chain
– Responsibility of the Runtime delivery moved to Dev
– Good fit with containerization
21
2018-2019
2019
| JF James | © Worldline | Touraine Tech
Challenges ahead of us
• Last but not least … Training … Experiencing … Knowledge sharing
– Java 9 is not just about fancy Dev features
– It is a game changer!
– Mastering modularity and its subtleties will take time
– It puts back good practices on the stage at the price of an additional complexity
– And don’t forget the other 79 changes ;-)
22
2018-2019-2020 …
| JF James | © Worldline | Touraine Tech
Main references
• Jigsaw Quickstart: http://openjdk.java.net/projects/jigsaw/quick-start
• Oracle JDK9 Migration Guide: https://docs.oracle.com/javase/9/migrate/
• Alex Buckley talk: https://www.youtube.com/watch?v=rfOjch4p0Po
25
| JF James | © Worldline | Touraine Tech
Other interesting references • http://in.relation.to/2017/04/11/accessing-private-state-of-java-9-modules/
• http://in.relation.to/2017/02/13/building-multi-release-jars-with-maven/
• https://www.youtube.com/watch?v=Txsl-K83ygI
• https://cwiki.apache.org/confluence/display/MAVEN/Java+9+-+Jigsaw
• https://blog.frankel.ch/migrating-to-java-9/1/#gsc.tab=0
• https://blog.frankel.ch/migrating-to-java-9/2/#gsc.tab=0
• https://blog.idrsolutions.com/2017/06/java-9-articles-series-index/
• https://blog.senacor.com/unit-testing-with-java-9-jigsaw-and-junit/
• https://stackoverflow.com/questions/46613214/java-9-maven-junit-does-test-code-need-module-info-java-of-its-own-and-wher
• https://issues.apache.org/jira/browse/SUREFIRE-1420
• https://blog.codefx.org/
• https://speakerdeck.com/forax/tu-modules-2#
• https://access.redhat.com/articles/1299013
• http://www.oracle.com/technetwork/java/eol-135779.html
26
| JF James | © Worldline | Touraine Tech
Java version history
27
Version Code Name Release date Delta (y) Size (MB) Size Increase
JDK 1.0 Oak janv-96 4
JDK 1.1 févr-97 1,0 9 125%
J2SE 1.2 Playground déc-98 1,8 20 122%
J2SE 1.3 Kestrel mai-00 1,4 24 20%
J2SE 1.4 Merlin févr-02 1,7 38 58%
J2SE 5.0 Tiger sept-04 2,6 40 5%
Java SE 6 Mustang déc-06 2,2 65 63%
Java SE 7 Dolphin juil-11 4,5 130 100%
Java SE 8 Spider mars-14 2,7 151 16%
Java SE 9 sept-17 3,5 304 101%
Atos, the Atos logo, Atos Consulting, Atos Worldgrid, Worldline, BlueKiwi, Bull, Canopy the Open Cloud Company, Yunano, Zero Email, Zero Email Certified and The Zero Email Company are registered trademarks of the Atos group. May 2015. © 2015 Atos. Confidential information owned by Atos, to be used by the recipient only. This document, or any part of it, may not be reproduced, copied, circulated and/or distributed nor quoted without prior written approval from Atos.
© Worldline
Thanks
For more information please contact: [email protected]