Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Taste of new in
Java 9
Arkadiusz Sokołowski
2015
Agenda
● A bit of history
● jshell
● JDK Benchmarks / jmh
● small stuff...
● jigsaw
● what’s beyond 9?
Bit of history
1991: Green (Oak)
1994: JDK EAs
Jan 1996: JDK 1.0
Feb 1997: JDK 1.1
Dec 1998: J2SE 1.2
May 2000: J2SE 1.3
F...
New versioning scheme
● Current scheme:
○ Minor releases containing changes beyond security
fixes are multiples of 20
○ Se...
New versioning scheme
● New scheme:
○ MAJOR.MINOR.SECURITY
○ 1.8.0 => 8.0.0
○ 1.8.0_05 => 8.0.1
○ 1.8.0_11 => 8.0.2
○ 1.8....
jshell
JDK Benchmark Suite
● based on JMH
● stable, tuned benchmarks
● targeted for continuous performance check
● lot of benchma...
Http/2
HttpResponse response = HttpRequest
.create(new URI("http://www.ocado.com"))
.body(noBody())
.GET().send();
int res...
Http/2
HttpRequest req = HttpRequest
.create(new URI("http://www.ocado.com"))
.body(noBody())
.GET();
CompletableFuture<Ht...
Unified JVM logging
● usage: -Xlog[:option]
● tags (GC, HTTP, security, …)
● levels (error, warning, info, debug, trace)
●...
Coin project - language adjustments
● allow @SaveVargs on private instance methods
● allow effectively-final variables in ...
Hotspot / JDK diagnostics
● print_class_summary
● print_codegen_list
● print_utf8pool
● dump_codelist
● print_codeblocks
●...
Other...
● improved contented locking
● variable handles (Unsafe!)
● sjavac
● fixed imports processing by javac
● Security...
Other...
● String internal representation altered
● Java-Level JVM Compiler Interface
● Parser API for Nashorn
● Support f...
Jigsaw - modules for Java
● Motivation:
○ JAR/classpath hell reduction
○ manual dependencies management
○ unexpressed/tran...
Copyright © Oracle 2015
Jigsaw - modules in Java8
Copyright © Oracle 2015
Jigsaw - piece of action...
Jigsaw - one more example
module com.foo.app {
requires com.foo.bar;
requires java.sql;
}
module java.sql {
requires java....
Jigsaw - one more example
Copyright © Oracle 2015
Jigsaw - implied readability
String url = ...;
Properties props = ...;
Driver d = DriverManager.getDriver(url);
Connection...
Jigsaw - implied readability
module java.sql {
requires public java.logging;
requires public java.xml;
exports java.sql;
e...
Jigsaw - implied readability
Copyright © Oracle 2015
Jigsaw - services
module com.mysql.jdbc {
requires java.sql;
requires org.slf4j;
exports com.mysql.jdbc;
}
Jigsaw - services
module java.sql {
requires public java.logging;
requires public java.xml;
exports java.sql;
exports java...
Jigsaw - services
module com.mysql.jdbc {
requires java.sql;
requires org.slf4j;
exports com.mysql.jdbc;
provides java.sql...
Jigsaw - services
Copyright © Oracle 2015
Jigsaw - qualified exports
module java.base {
...
exports sun.reflect to
java.corba,
java.logging,
java.sql,
java.sql.rows...
Jigsaw - qualified exports
Copyright © Oracle 2015
Java 10: value classes
value class Point {
int x;
int y;
Point(int x, int y) {
this.x = x;
this.y = y;
}
}
Java 10: generics
● Reified Generics
● Generics with values
List<int> intList = new ArrayList<>();
…
int val = intList.get...
Thank you!
...questions?
Upcoming SlideShare
Loading in …5
×

JDD2015: Taste of new in Java 9 - Arkadiusz Sokołowski

147 views

Published on

TASTE OF NEW IN JAVA 9

Do you know what are jshell, jmh and jigsaw? How can they help you and your team?
To give you the taste of Java 9, I will present the most interesting of its features in action.


I will present jshell (Java 9 REPL environment), jmh (micro-benchmarking for JVM), and jigsaw (Java 9 module) examples.


If you are interested in the future of core Java platform, this session is for you!

Published in: Software
  • Be the first to comment

  • Be the first to like this

JDD2015: Taste of new in Java 9 - Arkadiusz Sokołowski

  1. 1. Taste of new in Java 9 Arkadiusz Sokołowski 2015
  2. 2. Agenda ● A bit of history ● jshell ● JDK Benchmarks / jmh ● small stuff... ● jigsaw ● what’s beyond 9?
  3. 3. Bit of history 1991: Green (Oak) 1994: JDK EAs Jan 1996: JDK 1.0 Feb 1997: JDK 1.1 Dec 1998: J2SE 1.2 May 2000: J2SE 1.3 Feb 2002: J2SE 1.4 Sep 2004: J2SE 5.0 Dec 2006: Java SE 6 Jul 2011: Java SE 7 Mar 2014: Java SE 8 Sep 2016: Java SE 9 release Dec 2015: Java SE 9 feature complete
  4. 4. New versioning scheme ● Current scheme: ○ Minor releases containing changes beyond security fixes are multiples of 20 ○ Security releases based on the previous minor release are odd numbers incremented by five, or by six if necessary in order to keep the update number odd
  5. 5. New versioning scheme ● New scheme: ○ MAJOR.MINOR.SECURITY ○ 1.8.0 => 8.0.0 ○ 1.8.0_05 => 8.0.1 ○ 1.8.0_11 => 8.0.2 ○ 1.8.0_20 => 8.1.2 ○ 1.8.0_25 => 8.1.3
  6. 6. jshell
  7. 7. JDK Benchmark Suite ● based on JMH ● stable, tuned benchmarks ● targeted for continuous performance check ● lot of benchmarks for standard libraries ● comparison with JDK 8
  8. 8. Http/2 HttpResponse response = HttpRequest .create(new URI("http://www.ocado.com")) .body(noBody()) .GET().send(); int responseCode = response.responseCode(); String responseBody = response.body(asString()); System.out.println(responseBody);
  9. 9. Http/2 HttpRequest req = HttpRequest .create(new URI("http://www.ocado.com")) .body(noBody()) .GET(); CompletableFuture<HttpResponse> asyncResp = req.sendAsync(); Thread.sleep(10); if (!asyncResp.isDone()) { asyncResp.cancel(true); System.err.println("timeout"); return; } HttpResponse response = asyncResp.get();
  10. 10. Unified JVM logging ● usage: -Xlog[:option] ● tags (GC, HTTP, security, …) ● levels (error, warning, info, debug, trace) ● decorators (time, uptime, pid, tid, level, tag) ● output (can be rotated file!) ● -Xlog:gc=debug:file=gc.txt:uptime,level
  11. 11. Coin project - language adjustments ● allow @SaveVargs on private instance methods ● allow effectively-final variables in try-with-resources ● more type inference with generics ● underscore will be no more a valid identifier ● private methods in interfaces
  12. 12. Hotspot / JDK diagnostics ● print_class_summary ● print_codegen_list ● print_utf8pool ● dump_codelist ● print_codeblocks ● set_vmflags
  13. 13. Other... ● improved contented locking ● variable handles (Unsafe!) ● sjavac ● fixed imports processing by javac ● Security (Datagram / Application transport layer) ● HTML5 javadoc ● Unicode 8.0
  14. 14. Other... ● String internal representation altered ● Java-Level JVM Compiler Interface ● Parser API for Nashorn ● Support for AArch64 (ARMv8) architecture ● Compile for Older Platform Versions ● G1 will be default garbage collector ● Store Interned Strings in CDS archives
  15. 15. Jigsaw - modules for Java ● Motivation: ○ JAR/classpath hell reduction ○ manual dependencies management ○ unexpressed/transitive dependencies ○ hide some (private) packages; com.sun.misc.* ○ system instead of manual security ○ JRE size reduction
  16. 16. Copyright © Oracle 2015
  17. 17. Jigsaw - modules in Java8 Copyright © Oracle 2015
  18. 18. Jigsaw - piece of action...
  19. 19. Jigsaw - one more example module com.foo.app { requires com.foo.bar; requires java.sql; } module java.sql { requires java.logging; requires java.xml; exports java.sql; exports javax.sql; exports javax.transaction.xa; }
  20. 20. Jigsaw - one more example Copyright © Oracle 2015
  21. 21. Jigsaw - implied readability String url = ...; Properties props = ...; Driver d = DriverManager.getDriver(url); Connection c = d.connect(url, props); d.getParentLogger().info("Connection acquired");
  22. 22. Jigsaw - implied readability module java.sql { requires public java.logging; requires public java.xml; exports java.sql; exports javax.sql; exports javax.transaction.xa; }
  23. 23. Jigsaw - implied readability Copyright © Oracle 2015
  24. 24. Jigsaw - services module com.mysql.jdbc { requires java.sql; requires org.slf4j; exports com.mysql.jdbc; }
  25. 25. Jigsaw - services module java.sql { requires public java.logging; requires public java.xml; exports java.sql; exports javax.sql; exports javax.transaction.xa; uses java.sql.Driver; }
  26. 26. Jigsaw - services module com.mysql.jdbc { requires java.sql; requires org.slf4j; exports com.mysql.jdbc; provides java.sql.Driver with com.mysql.jdbc.Driver; }
  27. 27. Jigsaw - services Copyright © Oracle 2015
  28. 28. Jigsaw - qualified exports module java.base { ... exports sun.reflect to java.corba, java.logging, java.sql, java.sql.rowset, jdk.scripting.nashorn; }
  29. 29. Jigsaw - qualified exports Copyright © Oracle 2015
  30. 30. Java 10: value classes value class Point { int x; int y; Point(int x, int y) { this.x = x; this.y = y; } }
  31. 31. Java 10: generics ● Reified Generics ● Generics with values List<int> intList = new ArrayList<>(); … int val = intList.get(0); List<Point>... List$Point,
  32. 32. Thank you! ...questions?

×