SlideShare a Scribd company logo
1 of 41
sbordet@webtide.com
Java 9
Part 1: New Features
(Not Jigsaw Modules)
@simonebordet
sbordet@webtide.com
Simone Bordet
● @simonebordet
● sbordet@webtide.com
● Java Champion
● Works @ Webtide
● The company behind Jetty and CometD
● JVM Tuning Expert
sbordet@webtide.com
Java 9 Agenda
● Java 9 Introduction
● Java 9 Changes and New Features
○ Not Jigsaw Modules
● Java 9 Migration
● Open Discussion
sbordet@webtide.com
Java 9
● Java 9 comes with a MASSIVE number of changes
○ 91 JEPs (!)
● Biggest change: Jigsaw modules
○ Come to the next meeting :)
● Upgrade to Java 9 not as smooth as past JDKs
○ Needs very thorough testing
sbordet@webtide.com
Java 9
●
Java 9 is NOTa Long Term Support (LTS) Release
● Java 8 current LTS Release supported March 2014 - January 2019
● Java 9 supported September 2017 - March 2018
● Java 10 supported March 2018 - September 2018
● Java 11 new LTS Release September 2018 - September 2021
sbordet@webtide.com
● Removed tools.jar
○ Attach APIs
○ Programmatically call javac (JSP compilation), javadoc, etc.
● tools.jar content split into packages
○ jdk.attach
○ jdk.compiler (but use module java.compiler)
○ jdk.javadoc
● Removed JavaDB
○ Rebranding of Apache Derby
Java 9 Removals
sbordet@webtide.com
Java 9 Removals
● Removed endorsed directory mechanism
$JAVA_HOME/lib/endorsed
● Could only contain updates for:
○ CORBA
○ XML DOM
○ XML SAX
● Rarely used to update the implementations shipped with the JDK
sbordet@webtide.com
Java 9 Removals
● Removed Extension Directory Mechanism
○ Moved to modules
$JAVA_HOME/jre/lib/ext
nashorn.jar
jfxrt.jar
sunec.jar
sunjce_provider.jar
zipfs.jar
...
sbordet@webtide.com
Java 9 Changes
● ClassLoader Hierarchy
● Java 8
Boot CL <- Extension CL <- System CL
ClassLoader.getSystemClassLoader()
● Java 9
Boot CL <- Platform CL <- System CL
ClassLoader.getPlatformClassLoader()
ClassLoader.getSystemClassLoader()
sbordet@webtide.com
Java 9 Changes
● ClassLoading Implementation Changes
// Throws ClassCastException now!
URLClassLoader system = (URLClassLoader)ClassLoader.getSystemClassLoader();
● ClassLoader Resources
URL resource = system.getResource("java/lang/String.class");
resource = jrt:/java.base/java/lang/String.class
● Class scanning for annotations
○ Previous techniques not working in JDK 9
○ Cannot retrieve the list of jars to open
sbordet@webtide.com
Java 9 Changes
● JEP 223 - New Version String Scheme
○ System.getProperty("java.version")
○ 1.8.0_152 -> 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 New Features
● JEP 260 - Encapsulate Internal APIs
● Non-critical internal APIs have been removed
○ sun.misc.Base64Decoder
● Critical internal APIs without replacement -> retained
○ In module jdk.unsupported
○ For example, sun.misc.Unsafe
○ Don’t use them
● Critical internal APIs with replacement -> encapsulated
○ Use the replacements
sbordet@webtide.com
Java 9 New Features
● JEP 260 - Encapsulate Internal APIs
● Most internal APIs now have a public replacement
● Finalization
○ sun.misc.Cleaner replaced by java.lang.ref.Cleaner
○ Object.finalize() is now deprecated
● Unsafe access
○ Some sun.misc.Unsafe usage replaced by VarHandle
sbordet@webtide.com
Java 9 New Features
● JEP 260 - Encapsulate Internal APIs
● jdeps tool produces a report of class/jar/module dependencies
$ jdeps -s jetty-util-9.4.8-SNAPSHOT.jar
jetty-util-9.4.8-SNAPSHOT.jar -> java.base
jetty-util-9.4.8-SNAPSHOT.jar -> java.desktop
jetty-util-9.4.8-SNAPSHOT.jar -> java.logging
jetty-util-9.4.8-SNAPSHOT.jar -> java.naming
jetty-util-9.4.8-SNAPSHOT.jar -> java.sql
jetty-util-9.4.8-SNAPSHOT.jar -> java.xml
jetty-util-9.4.8-SNAPSHOT.jar -> not found
sbordet@webtide.com
Java 9 New Features
● JEP 247 - Compile for older platforms
● New switch --release to javac
○ Supports up to 3 previous releases
● $JAVA_HOME/lib/ct.sym
○ Zipped file containing the symbols for each platform
sbordet@webtide.com
Java 9 New Features
<profile>
<id>jdk9</id>
<activation>
<jdk>[1.9,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0+</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
</plugins>
</build>
</profile>
sbordet@webtide.com
Java 9 New Features
● JEP 238 - Multi Release jars
com/
acme/
A.class
B.class
C.class
META-INF/
versions/
9/
com/
acme/
A.class
D.class
sbordet@webtide.com
Java 9 Changes
● URLStreamHandler
● Java 8: Magic Reflection
○ sun.net.www.protocol.<scheme>.Handler
● Java 9: ServiceLoader
○ Implement java.net.spi.URLStreamHandlerProvider
● Difficult to make a jar with both solutions
○ Service files cannot be versioned
sbordet@webtide.com
Java 9 New Features
● JEP 213 - Small Language Changes
● Cannot use "_" as identifier
○ Object _ = new Object();
● Improved type inference
○ Use diamond notation in anonymous inner classes
● Private methods in interfaces
○ Useful to AOP frameworks
○ Avoids code duplications in default methods
sbordet@webtide.com
Java 9 New Features
● JEP 213 - Small Language Changes
● Enhanced try-with-resources
InputStream input = ...;
...
try (input) {
...
}
sbordet@webtide.com
Java 9 New Features
● JEP 264 - Platform Logging APIs
○ Implementation defaults to java.util.logging
System.getLogger("name")
.log(Level.INFO, () -> "a" + " - " + "b");
System.getLogger("name")
.log(Level.INFO, "%s - %s", a, b);
sbordet@webtide.com
Java 9 New Features
● JEP 254 - Compact Strings
○ java.lang.String now stores a byte[], not a char[]
● JEP 280 - String concatenation using invokedynamic
○ Faster and allocates less
● JEP 269 - Collections factory methods
○ Space efficient
List.of("a", "b", "c");
Set.of("a", "b", "c");
Map.of("a", 1, "b", 2, "c", 3);
sbordet@webtide.com
Java 9 New Features
● JEP 193 - Variable Handles
class ConcurrentLinkedQueue_BAD {
AtomicReference<Node> head; // BAD, adds indirection
}
class ConcurrentLinkedQueue {
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 New Features
● JEP 102 - Process API
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 New Features
● JEP 102 - Process API
Optional<Duration> cpuTimeOpt = ProcessHandle.current().info()
.totalCpuDuration();
long cpuTime = cpuTimeOpt
.map(duration -> duration.toNanos())
.orElse(-1L);
sbordet@webtide.com
Java 9 New Features
● JEP 266 - Concurrent APIs Enhancements
● java.util.concurrent.Flow
○ Identical API 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
● JEP 143 - Improve Contended Locking
○ synchronized now as scalable as java.util.concurrent.Lock
http://vmlens.com/articles/performance-improvements-of-java-monitor/
Java 9 Changes
sbordet@webtide.com
Java 9 New Features
● JEP 295: Ahead-of-Time Compilation
○ Experimental
○ Based on the Java-based Graal JIT compiler
https://mjg123.github.io/2017/10/02/JVM-startup.html
sbordet@webtide.com
Java 9 New Features
● JEP 222 - jshell Read-Eval-Print-Loop (REPL)
○ Can be accessed programmatically via module jdk.jshell
● Pretty powerful !
○ Completion
○ Imports
○ Variable creation
○ Documentation
○ Functions and Forward References
○ History
○ Search
○ External Editor
sbordet@webtide.com
Java 9 Changes
● JEP 248 - Make G1 the Default Collector
● 250+ Improvements
○ Adaptive start of concurrent mark -XX:+G1UseAdaptiveIHOP
○ Made internal data structures more concurrent
○ More phases parallelized
○ Reduced contention
○ Reduced memory consumption
○ …
● 180+ Bug Fixes
sbordet@webtide.com
Java 9 Changes
● JEP 158 - Unified JVM Logging
● Logs have a message, tags (finally) and a level; can be decorated
● Tags
○ gc, ref, ergo, …
● Levels
○ error, warning, info, debug, trace
● Output
○ stdout, stderr, file
● Decorators
○ time (various formats), pid, tid, level, tags
● Default
○ -Xlog:all=warning:stderr:uptime,level,tags
sbordet@webtide.com
Java 9 Changes
● JEP 271 - Unified GC Logging
○ Done using JEP 158 - Unified JVM Logging
● Example for GC logging
○ -Xlog:gc*,ergo*=trace,ref*=debug:file=logs/gc.log:time,level,tags
● Not compatible with previous logging formats
○ Need to parse the logs differently
sbordet@webtide.com
Java 9 Changes
● JVM Options Changes
○ 50 Removed - JVM refuses to start
○ 18 Ignored, 12 Deprecated
● Important JVM Options Removed
○ GCLogFileSize
○ NumberOfGCLogFiles
○ PrintAdaptiveSizePolicy
○ PrintGCApplicationStoppedTime
○ PrintGCCause
○ PrintGCDateStamps
○ PrintGCTimeStamps
○ PrintReferenceGC
○ PrintTenuringDistribution
○ ...
sbordet@webtide.com
Java 9 Changes
● JEP 277 - Enhanced Deprecation
@Deprecated(since="1.8", forRemoval=true)
● jdeprscan
○ Produces a report of deprecations
sbordet@webtide.com
Java 9 Changes
● JEP 229 - Keystore Defaults to PKCS12
● PKCS12
○ Standard format, more secure, more extensible
○ Already supported in JDK 8
● JDK 9
○ keytool by default creates PKCS12 keystores
○ Autodetects JKS and PKCS12 keystores
sbordet@webtide.com
Java 9 New Features
● JEP 219 - Datagram Transport Layer Security (DTLS)
● JEP 244 - TLS Application-Layer Protocol Negotiation Extension (ALPN)
● JEP 246 - Leverage CPU Instructions for GHASH and RSA
● JEP 249 - OCSP Stapling for TLS
● JEP 273 - DRBG-Based SecureRandom Implementations
● JEP 287 - SHA-3 Hash Algorithms
● JEP 288 - Disable SHA-1 Certificates
sbordet@webtide.com
Java 9 Migration
● Migrating to Java 9 is an iterative process
○ Typically cannot be done in one step only
● Update dependencies
● Run jdeps -jdkinternals
● Fix usages of encapsulated APIs
● Using EE modules ?
● Add --add-modules to command line
sbordet@webtide.com
Java 9 Migration
● Update command line options
● Fix GC logging
● Fix your System.getProperty("java.version") usages
● Do not do deep reflection on JDK classes
○ Do not use setAccessible(true);
● Verify your ClassLoader usages
● Verify your sun.* usages
sbordet@webtide.com
Migrating OWNER to Java 9
Problems migrating OWNER:
1. Options removed from command line tools (javac, java,etc)
2. Some classes and packages have been removed
○ I.e. java.lang.NoClassDefFoundError:
javax/xml/bind/DatatypeConverter
3. Problems with some libraries and maven plugins not ready for JDK 9
→ update/drop these dependencies.
4. Some jdk classes have been improved and expose some internal
changes (Hashtable.toString() → failing tests).
sbordet@webtide.com
Migrating OWNER to Java 9
5. Custom URLStreamHandlers changed. → Multi release jar →
reimplement url loading mechanism in OWNER itself.
6. Some reflection API changed (Invoking default methods on
Interfaces): MethodHandles.Lookup.unreflectSpecial() → using new
API for JDK9
7. Mockito 1.x is not Java9 ready → port tests to Mockito 2.x (work in
progress)
Questions ?

More Related Content

What's hot

Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)
Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)
Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)Red Hat Developers
 
Gestión de infraestructura tomcat tom ee con tfactory
Gestión de infraestructura tomcat tom ee con tfactoryGestión de infraestructura tomcat tom ee con tfactory
Gestión de infraestructura tomcat tom ee con tfactoryCésar Hernández
 
Java11 New Features
Java11 New FeaturesJava11 New Features
Java11 New FeaturesHaim Michael
 
CICD Pipeline configuration as a code
CICD Pipeline configuration as a codeCICD Pipeline configuration as a code
CICD Pipeline configuration as a codeGrid Dynamics
 
Hackathon - building and extending OpenJDK
Hackathon - building and extending OpenJDKHackathon - building and extending OpenJDK
Hackathon - building and extending OpenJDKMichał Warecki
 
ReactJS Component Lifecycle hooks with examples
ReactJS Component Lifecycle hooks with examples ReactJS Component Lifecycle hooks with examples
ReactJS Component Lifecycle hooks with examples Ravi Mone
 
Using Grails to Power your Electric Car
Using Grails to Power your Electric CarUsing Grails to Power your Electric Car
Using Grails to Power your Electric CarGR8Conf
 
What is new with JavaScript in Gnome: The 2021 edition
What is new with JavaScript in Gnome: The 2021 editionWhat is new with JavaScript in Gnome: The 2021 edition
What is new with JavaScript in Gnome: The 2021 editionIgalia
 
2013 05 java 7 brown bag part 1 - new features and migration strategy
2013 05 java 7 brown bag part 1 - new features and migration strategy2013 05 java 7 brown bag part 1 - new features and migration strategy
2013 05 java 7 brown bag part 1 - new features and migration strategyNeil Brown
 
Functional and scale performance tests using zopkio
Functional and scale performance tests using zopkio Functional and scale performance tests using zopkio
Functional and scale performance tests using zopkio Marcelo Araujo
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceJesse Vincent
 
Cloud TiDB deep dive
Cloud TiDB deep diveCloud TiDB deep dive
Cloud TiDB deep dive臣 成
 
NetBeans Support for EcmaScript 6
NetBeans Support for EcmaScript 6NetBeans Support for EcmaScript 6
NetBeans Support for EcmaScript 6Kostas Saidis
 
Angular JS in 2017
Angular JS in 2017Angular JS in 2017
Angular JS in 2017Ayush Sharma
 
State of the Art OpenGL and Qt
State of the Art OpenGL and QtState of the Art OpenGL and Qt
State of the Art OpenGL and QtICS
 
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie..."How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...Fwdays
 
UE4 Tips and Tricks - Unreal Engine Toronto User Group - Meetup #2
UE4 Tips and Tricks - Unreal Engine Toronto User Group - Meetup #2UE4 Tips and Tricks - Unreal Engine Toronto User Group - Meetup #2
UE4 Tips and Tricks - Unreal Engine Toronto User Group - Meetup #2Robert Segal
 

What's hot (20)

Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)
Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)
Shenandoah GC: Java Without The Garbage Collection Hiccups (Christine Flood)
 
Gestión de infraestructura tomcat tom ee con tfactory
Gestión de infraestructura tomcat tom ee con tfactoryGestión de infraestructura tomcat tom ee con tfactory
Gestión de infraestructura tomcat tom ee con tfactory
 
Java11 New Features
Java11 New FeaturesJava11 New Features
Java11 New Features
 
CICD Pipeline configuration as a code
CICD Pipeline configuration as a codeCICD Pipeline configuration as a code
CICD Pipeline configuration as a code
 
Hackathon - building and extending OpenJDK
Hackathon - building and extending OpenJDKHackathon - building and extending OpenJDK
Hackathon - building and extending OpenJDK
 
Testing in go
Testing in goTesting in go
Testing in go
 
ReactJS Component Lifecycle hooks with examples
ReactJS Component Lifecycle hooks with examples ReactJS Component Lifecycle hooks with examples
ReactJS Component Lifecycle hooks with examples
 
Using Grails to Power your Electric Car
Using Grails to Power your Electric CarUsing Grails to Power your Electric Car
Using Grails to Power your Electric Car
 
What is new with JavaScript in Gnome: The 2021 edition
What is new with JavaScript in Gnome: The 2021 editionWhat is new with JavaScript in Gnome: The 2021 edition
What is new with JavaScript in Gnome: The 2021 edition
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
2013 05 java 7 brown bag part 1 - new features and migration strategy
2013 05 java 7 brown bag part 1 - new features and migration strategy2013 05 java 7 brown bag part 1 - new features and migration strategy
2013 05 java 7 brown bag part 1 - new features and migration strategy
 
Functional and scale performance tests using zopkio
Functional and scale performance tests using zopkio Functional and scale performance tests using zopkio
Functional and scale performance tests using zopkio
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret Sauce
 
Cloud TiDB deep dive
Cloud TiDB deep diveCloud TiDB deep dive
Cloud TiDB deep dive
 
Nodejs
NodejsNodejs
Nodejs
 
NetBeans Support for EcmaScript 6
NetBeans Support for EcmaScript 6NetBeans Support for EcmaScript 6
NetBeans Support for EcmaScript 6
 
Angular JS in 2017
Angular JS in 2017Angular JS in 2017
Angular JS in 2017
 
State of the Art OpenGL and Qt
State of the Art OpenGL and QtState of the Art OpenGL and Qt
State of the Art OpenGL and Qt
 
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie..."How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
 
UE4 Tips and Tricks - Unreal Engine Toronto User Group - Meetup #2
UE4 Tips and Tricks - Unreal Engine Toronto User Group - Meetup #2UE4 Tips and Tricks - Unreal Engine Toronto User Group - Meetup #2
UE4 Tips and Tricks - Unreal Engine Toronto User Group - Meetup #2
 

Similar to Java 9 - Part1: New Features (Not Jigsaw Modules)

What's coming in Airflow 2.0? - NYC Apache Airflow Meetup
What's coming in Airflow 2.0? - NYC Apache Airflow MeetupWhat's coming in Airflow 2.0? - NYC Apache Airflow Meetup
What's coming in Airflow 2.0? - NYC Apache Airflow MeetupKaxil Naik
 
How to jSparrow Jenkins?
How to jSparrow Jenkins?How to jSparrow Jenkins?
How to jSparrow Jenkins?jSparrow
 
Sprint 180
Sprint 180Sprint 180
Sprint 180ManageIQ
 
Gobblin @ NerdWallet (Nov 2015)
Gobblin @ NerdWallet (Nov 2015)Gobblin @ NerdWallet (Nov 2015)
Gobblin @ NerdWallet (Nov 2015)NerdWalletHQ
 
Sprint 218
Sprint 218Sprint 218
Sprint 218ManageIQ
 
Prepare for JDK 9
Prepare for JDK 9Prepare for JDK 9
Prepare for JDK 9haochenglee
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015Jorg Janke
 
G1: To Infinity and Beyond
G1: To Infinity and BeyondG1: To Infinity and Beyond
G1: To Infinity and BeyondScyllaDB
 
Java 8 -12: da Oracle a Eclipse. Due anni e una rivoluzione
Java 8 -12: da Oracle a Eclipse. Due anni e una rivoluzioneJava 8 -12: da Oracle a Eclipse. Due anni e una rivoluzione
Java 8 -12: da Oracle a Eclipse. Due anni e una rivoluzioneThinkOpen
 
Sprint 189
Sprint 189Sprint 189
Sprint 189ManageIQ
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbWei Shan Ang
 
JDD2015: Taste of new in Java 9 - Arkadiusz Sokołowski
JDD2015: Taste of new in Java 9 - Arkadiusz SokołowskiJDD2015: Taste of new in Java 9 - Arkadiusz Sokołowski
JDD2015: Taste of new in Java 9 - Arkadiusz SokołowskiPROIDEA
 
Troubleshooting MySQL from a MySQL Developer Perspective
Troubleshooting MySQL from a MySQL Developer PerspectiveTroubleshooting MySQL from a MySQL Developer Perspective
Troubleshooting MySQL from a MySQL Developer PerspectiveMarcelo Altmann
 
Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"Fwdays
 
Sprint 186
Sprint 186Sprint 186
Sprint 186ManageIQ
 
Online Upgrade Using Logical Replication.
Online Upgrade Using Logical Replication.Online Upgrade Using Logical Replication.
Online Upgrade Using Logical Replication.EDB
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers WorkshopJody Garnett
 
Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9Anna Shymchenko
 

Similar to Java 9 - Part1: New Features (Not Jigsaw Modules) (20)

What's coming in Airflow 2.0? - NYC Apache Airflow Meetup
What's coming in Airflow 2.0? - NYC Apache Airflow MeetupWhat's coming in Airflow 2.0? - NYC Apache Airflow Meetup
What's coming in Airflow 2.0? - NYC Apache Airflow Meetup
 
Java 9 and Project Jigsaw
Java 9 and Project JigsawJava 9 and Project Jigsaw
Java 9 and Project Jigsaw
 
How to jSparrow Jenkins?
How to jSparrow Jenkins?How to jSparrow Jenkins?
How to jSparrow Jenkins?
 
Sprint 180
Sprint 180Sprint 180
Sprint 180
 
Sprint 180
Sprint 180Sprint 180
Sprint 180
 
Gobblin @ NerdWallet (Nov 2015)
Gobblin @ NerdWallet (Nov 2015)Gobblin @ NerdWallet (Nov 2015)
Gobblin @ NerdWallet (Nov 2015)
 
Sprint 218
Sprint 218Sprint 218
Sprint 218
 
Prepare for JDK 9
Prepare for JDK 9Prepare for JDK 9
Prepare for JDK 9
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
 
G1: To Infinity and Beyond
G1: To Infinity and BeyondG1: To Infinity and Beyond
G1: To Infinity and Beyond
 
Java 8 -12: da Oracle a Eclipse. Due anni e una rivoluzione
Java 8 -12: da Oracle a Eclipse. Due anni e una rivoluzioneJava 8 -12: da Oracle a Eclipse. Due anni e una rivoluzione
Java 8 -12: da Oracle a Eclipse. Due anni e una rivoluzione
 
Sprint 189
Sprint 189Sprint 189
Sprint 189
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodb
 
JDD2015: Taste of new in Java 9 - Arkadiusz Sokołowski
JDD2015: Taste of new in Java 9 - Arkadiusz SokołowskiJDD2015: Taste of new in Java 9 - Arkadiusz Sokołowski
JDD2015: Taste of new in Java 9 - Arkadiusz Sokołowski
 
Troubleshooting MySQL from a MySQL Developer Perspective
Troubleshooting MySQL from a MySQL Developer PerspectiveTroubleshooting MySQL from a MySQL Developer Perspective
Troubleshooting MySQL from a MySQL Developer Perspective
 
Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"
 
Sprint 186
Sprint 186Sprint 186
Sprint 186
 
Online Upgrade Using Logical Replication.
Online Upgrade Using Logical Replication.Online Upgrade Using Logical Replication.
Online Upgrade Using Logical Replication.
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers Workshop
 
Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9
 

Recently uploaded

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
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
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
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
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
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
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
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
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
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 

Recently uploaded (20)

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
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
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
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
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
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
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
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
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...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 

Java 9 - Part1: New Features (Not Jigsaw Modules)

  • 1. sbordet@webtide.com Java 9 Part 1: New Features (Not Jigsaw Modules) @simonebordet
  • 2. sbordet@webtide.com Simone Bordet ● @simonebordet ● sbordet@webtide.com ● Java Champion ● Works @ Webtide ● The company behind Jetty and CometD ● JVM Tuning Expert
  • 3. sbordet@webtide.com Java 9 Agenda ● Java 9 Introduction ● Java 9 Changes and New Features ○ Not Jigsaw Modules ● Java 9 Migration ● Open Discussion
  • 4. sbordet@webtide.com Java 9 ● Java 9 comes with a MASSIVE number of changes ○ 91 JEPs (!) ● Biggest change: Jigsaw modules ○ Come to the next meeting :) ● Upgrade to Java 9 not as smooth as past JDKs ○ Needs very thorough testing
  • 5. sbordet@webtide.com Java 9 ● Java 9 is NOTa Long Term Support (LTS) Release ● Java 8 current LTS Release supported March 2014 - January 2019 ● Java 9 supported September 2017 - March 2018 ● Java 10 supported March 2018 - September 2018 ● Java 11 new LTS Release September 2018 - September 2021
  • 6. sbordet@webtide.com ● Removed tools.jar ○ Attach APIs ○ Programmatically call javac (JSP compilation), javadoc, etc. ● tools.jar content split into packages ○ jdk.attach ○ jdk.compiler (but use module java.compiler) ○ jdk.javadoc ● Removed JavaDB ○ Rebranding of Apache Derby Java 9 Removals
  • 7. sbordet@webtide.com Java 9 Removals ● Removed endorsed directory mechanism $JAVA_HOME/lib/endorsed ● Could only contain updates for: ○ CORBA ○ XML DOM ○ XML SAX ● Rarely used to update the implementations shipped with the JDK
  • 8. sbordet@webtide.com Java 9 Removals ● Removed Extension Directory Mechanism ○ Moved to modules $JAVA_HOME/jre/lib/ext nashorn.jar jfxrt.jar sunec.jar sunjce_provider.jar zipfs.jar ...
  • 9. sbordet@webtide.com Java 9 Changes ● ClassLoader Hierarchy ● Java 8 Boot CL <- Extension CL <- System CL ClassLoader.getSystemClassLoader() ● Java 9 Boot CL <- Platform CL <- System CL ClassLoader.getPlatformClassLoader() ClassLoader.getSystemClassLoader()
  • 10. sbordet@webtide.com Java 9 Changes ● ClassLoading Implementation Changes // Throws ClassCastException now! URLClassLoader system = (URLClassLoader)ClassLoader.getSystemClassLoader(); ● ClassLoader Resources URL resource = system.getResource("java/lang/String.class"); resource = jrt:/java.base/java/lang/String.class ● Class scanning for annotations ○ Previous techniques not working in JDK 9 ○ Cannot retrieve the list of jars to open
  • 11. sbordet@webtide.com Java 9 Changes ● JEP 223 - New Version String Scheme ○ System.getProperty("java.version") ○ 1.8.0_152 -> 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
  • 12. sbordet@webtide.com Java 9 New Features ● JEP 260 - Encapsulate Internal APIs ● Non-critical internal APIs have been removed ○ sun.misc.Base64Decoder ● Critical internal APIs without replacement -> retained ○ In module jdk.unsupported ○ For example, sun.misc.Unsafe ○ Don’t use them ● Critical internal APIs with replacement -> encapsulated ○ Use the replacements
  • 13. sbordet@webtide.com Java 9 New Features ● JEP 260 - Encapsulate Internal APIs ● Most internal APIs now have a public replacement ● Finalization ○ sun.misc.Cleaner replaced by java.lang.ref.Cleaner ○ Object.finalize() is now deprecated ● Unsafe access ○ Some sun.misc.Unsafe usage replaced by VarHandle
  • 14. sbordet@webtide.com Java 9 New Features ● JEP 260 - Encapsulate Internal APIs ● jdeps tool produces a report of class/jar/module dependencies $ jdeps -s jetty-util-9.4.8-SNAPSHOT.jar jetty-util-9.4.8-SNAPSHOT.jar -> java.base jetty-util-9.4.8-SNAPSHOT.jar -> java.desktop jetty-util-9.4.8-SNAPSHOT.jar -> java.logging jetty-util-9.4.8-SNAPSHOT.jar -> java.naming jetty-util-9.4.8-SNAPSHOT.jar -> java.sql jetty-util-9.4.8-SNAPSHOT.jar -> java.xml jetty-util-9.4.8-SNAPSHOT.jar -> not found
  • 15. sbordet@webtide.com Java 9 New Features ● JEP 247 - Compile for older platforms ● New switch --release to javac ○ Supports up to 3 previous releases ● $JAVA_HOME/lib/ct.sym ○ Zipped file containing the symbols for each platform
  • 16. sbordet@webtide.com Java 9 New Features <profile> <id>jdk9</id> <activation> <jdk>[1.9,)</jdk> </activation> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.0+</version> <configuration> <release>8</release> </configuration> </plugin> </plugins> </build> </profile>
  • 17. sbordet@webtide.com Java 9 New Features ● JEP 238 - Multi Release jars com/ acme/ A.class B.class C.class META-INF/ versions/ 9/ com/ acme/ A.class D.class
  • 18. sbordet@webtide.com Java 9 Changes ● URLStreamHandler ● Java 8: Magic Reflection ○ sun.net.www.protocol.<scheme>.Handler ● Java 9: ServiceLoader ○ Implement java.net.spi.URLStreamHandlerProvider ● Difficult to make a jar with both solutions ○ Service files cannot be versioned
  • 19. sbordet@webtide.com Java 9 New Features ● JEP 213 - Small Language Changes ● Cannot use "_" as identifier ○ Object _ = new Object(); ● Improved type inference ○ Use diamond notation in anonymous inner classes ● Private methods in interfaces ○ Useful to AOP frameworks ○ Avoids code duplications in default methods
  • 20. sbordet@webtide.com Java 9 New Features ● JEP 213 - Small Language Changes ● Enhanced try-with-resources InputStream input = ...; ... try (input) { ... }
  • 21. sbordet@webtide.com Java 9 New Features ● JEP 264 - Platform Logging APIs ○ Implementation defaults to java.util.logging System.getLogger("name") .log(Level.INFO, () -> "a" + " - " + "b"); System.getLogger("name") .log(Level.INFO, "%s - %s", a, b);
  • 22. sbordet@webtide.com Java 9 New Features ● JEP 254 - Compact Strings ○ java.lang.String now stores a byte[], not a char[] ● JEP 280 - String concatenation using invokedynamic ○ Faster and allocates less ● JEP 269 - Collections factory methods ○ Space efficient List.of("a", "b", "c"); Set.of("a", "b", "c"); Map.of("a", 1, "b", 2, "c", 3);
  • 23. sbordet@webtide.com Java 9 New Features ● JEP 193 - Variable Handles class ConcurrentLinkedQueue_BAD { AtomicReference<Node> head; // BAD, adds indirection } class ConcurrentLinkedQueue { Node head; private static final VarHandle HEAD; static { HEAD = MethodHandles.lookup() .findVarHandle(ConcurrentLinkedQueue.class, "head", Node.class); } public void m() { if (HEAD.compareAndSet(...)) ... } }
  • 24. sbordet@webtide.com Java 9 New Features ● JEP 102 - Process API 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()) );
  • 25. sbordet@webtide.com Java 9 New Features ● JEP 102 - Process API Optional<Duration> cpuTimeOpt = ProcessHandle.current().info() .totalCpuDuration(); long cpuTime = cpuTimeOpt .map(duration -> duration.toNanos()) .orElse(-1L);
  • 26. sbordet@webtide.com Java 9 New Features ● JEP 266 - Concurrent APIs Enhancements ● java.util.concurrent.Flow ○ Identical API 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)
  • 27. sbordet@webtide.com ● JEP 143 - Improve Contended Locking ○ synchronized now as scalable as java.util.concurrent.Lock http://vmlens.com/articles/performance-improvements-of-java-monitor/ Java 9 Changes
  • 28. sbordet@webtide.com Java 9 New Features ● JEP 295: Ahead-of-Time Compilation ○ Experimental ○ Based on the Java-based Graal JIT compiler https://mjg123.github.io/2017/10/02/JVM-startup.html
  • 29. sbordet@webtide.com Java 9 New Features ● JEP 222 - jshell Read-Eval-Print-Loop (REPL) ○ Can be accessed programmatically via module jdk.jshell ● Pretty powerful ! ○ Completion ○ Imports ○ Variable creation ○ Documentation ○ Functions and Forward References ○ History ○ Search ○ External Editor
  • 30. sbordet@webtide.com Java 9 Changes ● JEP 248 - Make G1 the Default Collector ● 250+ Improvements ○ Adaptive start of concurrent mark -XX:+G1UseAdaptiveIHOP ○ Made internal data structures more concurrent ○ More phases parallelized ○ Reduced contention ○ Reduced memory consumption ○ … ● 180+ Bug Fixes
  • 31. sbordet@webtide.com Java 9 Changes ● JEP 158 - Unified JVM Logging ● Logs have a message, tags (finally) and a level; can be decorated ● Tags ○ gc, ref, ergo, … ● Levels ○ error, warning, info, debug, trace ● Output ○ stdout, stderr, file ● Decorators ○ time (various formats), pid, tid, level, tags ● Default ○ -Xlog:all=warning:stderr:uptime,level,tags
  • 32. sbordet@webtide.com Java 9 Changes ● JEP 271 - Unified GC Logging ○ Done using JEP 158 - Unified JVM Logging ● Example for GC logging ○ -Xlog:gc*,ergo*=trace,ref*=debug:file=logs/gc.log:time,level,tags ● Not compatible with previous logging formats ○ Need to parse the logs differently
  • 33. sbordet@webtide.com Java 9 Changes ● JVM Options Changes ○ 50 Removed - JVM refuses to start ○ 18 Ignored, 12 Deprecated ● Important JVM Options Removed ○ GCLogFileSize ○ NumberOfGCLogFiles ○ PrintAdaptiveSizePolicy ○ PrintGCApplicationStoppedTime ○ PrintGCCause ○ PrintGCDateStamps ○ PrintGCTimeStamps ○ PrintReferenceGC ○ PrintTenuringDistribution ○ ...
  • 34. sbordet@webtide.com Java 9 Changes ● JEP 277 - Enhanced Deprecation @Deprecated(since="1.8", forRemoval=true) ● jdeprscan ○ Produces a report of deprecations
  • 35. sbordet@webtide.com Java 9 Changes ● JEP 229 - Keystore Defaults to PKCS12 ● PKCS12 ○ Standard format, more secure, more extensible ○ Already supported in JDK 8 ● JDK 9 ○ keytool by default creates PKCS12 keystores ○ Autodetects JKS and PKCS12 keystores
  • 36. sbordet@webtide.com Java 9 New Features ● JEP 219 - Datagram Transport Layer Security (DTLS) ● JEP 244 - TLS Application-Layer Protocol Negotiation Extension (ALPN) ● JEP 246 - Leverage CPU Instructions for GHASH and RSA ● JEP 249 - OCSP Stapling for TLS ● JEP 273 - DRBG-Based SecureRandom Implementations ● JEP 287 - SHA-3 Hash Algorithms ● JEP 288 - Disable SHA-1 Certificates
  • 37. sbordet@webtide.com Java 9 Migration ● Migrating to Java 9 is an iterative process ○ Typically cannot be done in one step only ● Update dependencies ● Run jdeps -jdkinternals ● Fix usages of encapsulated APIs ● Using EE modules ? ● Add --add-modules to command line
  • 38. sbordet@webtide.com Java 9 Migration ● Update command line options ● Fix GC logging ● Fix your System.getProperty("java.version") usages ● Do not do deep reflection on JDK classes ○ Do not use setAccessible(true); ● Verify your ClassLoader usages ● Verify your sun.* usages
  • 39. sbordet@webtide.com Migrating OWNER to Java 9 Problems migrating OWNER: 1. Options removed from command line tools (javac, java,etc) 2. Some classes and packages have been removed ○ I.e. java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter 3. Problems with some libraries and maven plugins not ready for JDK 9 → update/drop these dependencies. 4. Some jdk classes have been improved and expose some internal changes (Hashtable.toString() → failing tests).
  • 40. sbordet@webtide.com Migrating OWNER to Java 9 5. Custom URLStreamHandlers changed. → Multi release jar → reimplement url loading mechanism in OWNER itself. 6. Some reflection API changed (Invoking default methods on Interfaces): MethodHandles.Lookup.unreflectSpecial() → using new API for JDK9 7. Mockito 1.x is not Java9 ready → port tests to Mockito 2.x (work in progress)

Editor's Notes

  1. Problems migrating OWNER: Options removed from command line tools (javac, java) Source/Target option 1.5 is no longer supported → You need to use jdk 6 or later (and drop jdk 5 support). Some classes and packages have been removed I.e. java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter I was using that class for Base64 encoding, so I needed to remove the dependency to javax.xml.bind package and implement a Base64 class that works from JDK 6 to 9 using available classes on the specific JDK. Problems with some libraries and maven plugins not ready for JDK 9 → update/drop these dependencies. New dependencies → new rules → new problems :) (i.e. maven-jar-plugin useDefaultManifestFile has been deprecated, and now just makes the build fail) Some jdk classes have been improved and expose some internal changes. I.e. in Hashtable some method behave differently (toString order of properties is different, some unit tests were failing)
  2. Custom URLStreamHandlers changed. → Multi release jar → reimplement url loading mechanism in OWNER itself. Multi release jar (pom.xml changes ok... but most IDE can have issues: different source folders using different source/target to compile → IDE can’t tell you if you are using missing classes/etc.) Dropped the mechanism used and re-implemented internally. Some reflection API changed (Invoking default methods on Interfaces): MethodHandles.Lookup.unreflectSpecial() → using new API for JDK9 Mockito 1.x is not Java9 ready → port tests to Mockito 2.x (work in progress)