Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dev Nexus Java 12 & Release Model

Dev Nexus Java 12 & Release Model

Jeanne Boyarsky

March 08, 2019
Tweet

More Decks by Jeanne Boyarsky

Other Decks in Technology

Transcript

  1. @jeanneboyarsky Jeanne Boyarsky Friday, March 8, 2019 Dev Nexus Java

    12 – Keeping the Java Release Train on the Right Track speakerdeck.com/boyarsky
  2. @jeanneboyarsky Martijn Verberg (JClarity) Simon Ritter (Azul) Steve Poole &

    Tim Ellison (IBM) Simon Maple (LJC) Trisha Gee (IntelliJ) Roman Kennke (Red Hat) Thank you to…
  3. @jeanneboyarsky For more on Java 9 (or 10 or 11),

    see: https://speakerdeck.com/ boyarsky 5
  4. @jeanneboyarsky Til Java 6 (1996- 2006) Hi Oracle (2010) Java

    7 (2011) Java 8 (2014) Java 9 (2017) 9
  5. @jeanneboyarsky The Saga of Jigsaw •  2011 – Maybe part

    of Java 7. Nope Plan B •  2012 - Part of Java 8. No wait •  2014 - Part of Java 9 10
  6. @jeanneboyarsky Wait, a major version every 6 months? •  +

    Syntax changes •  + Smaller features •  - Years of features JDK 10 JDK 11 JDK 12 12 new features 15 new features 8 new features 14
  7. @jeanneboyarsky Java School Report Card Developer Community à A Features

    à B Frequency of Release à F Predictability of Release à D 15
  8. @jeanneboyarsky JVM College Report Card Vocabulary à B Polyglot programming

    à A Frequency of Release à F Predictability of Release à D 16
  9. @jeanneboyarsky How many languages do you know? q  One (or

    zero) q  Two – Five q  Six or more Examples •  Java •  Kotlin •  Groovy •  Scala •  SQL •  HTML •  JavaScript •  CSS 18
  10. @jeanneboyarsky Before Now Releases every Varies 6 months (or 3

    years LTS) Releases are Feature driven Date driven Oracle/OpenJDK Communications
  11. @jeanneboyarsky Patches Ask vendor a question What is Long Term

    Support? Oracle defined as 3 years. Other vendors (mostly) following definition.
  12. @jeanneboyarsky Oracle/OpenJDK Arrivals Train Schedule Java Release Date Long Term

    Support 10 March 20, 2018 11 September 25, 2018 12 March 10, 2019 24
  13. @jeanneboyarsky Oracle Security Patches Departure Schedule Java Public Patches Paid

    Patches 7 2015 2022 8 January 2019 (business) December 2020 (public) 2025 25
  14. @jeanneboyarsky Oracle/OpenJDK Security Patches Departure Schedule Java Public patches Paid

    patches 10 September 2018 n/a 11 March 2019 2023-2028 12 September 2019 n/a 26
  15. @jeanneboyarsky Looking at that another way Once Java 12 comes

    out, what does Oracle issue patches for? Open JDK 12 Oracle Java 11 (Paid) 27
  16. @jeanneboyarsky Wait. So what happens next? How long will Java

    12 have Oracle patches? Answer: 6 months What is the next LTS version after Java 11? Java 11 + 3*2 = 17 28
  17. @jeanneboyarsky A Tale of Two JDKs Java Oracle JDK Open

    JDK New Version Every 3 years Every 6 months Cost Paid Free Upgrade Options •  Security patch •  Next version •  OpenJDK •  Interim security patch •  Next version 29 Note: Oracle also publishes Open JDK 6 months for dev; not EA
  18. @jeanneboyarsky Found it! 31 Some closed-source parts of the Oracle

    JDK were open-sourced •  Flight recorder •  Mission control •  Others
  19. @jeanneboyarsky Where did it go? 32 Other closed-source parts were

    removed •  Browser Plugin •  Java Web Start •  JavaFX (Lives on as OpenJFX)
  20. @jeanneboyarsky FUD quiz #1 There will be a LTS release

    every 3 years. How long for free updates? 6 months 33
  21. @jeanneboyarsky FUD quiz #2 Which of these require a paid

    license to Oracle? •  Open JDK 11 •  Oracle JDK 11 Oracle JDK 11 34
  22. @jeanneboyarsky FUD quiz #3 How long can Oracle JDK 8

    be used in Prod for free? Forever (but no security patches) 35
  23. @jeanneboyarsky FUD quiz #7 Is it enough to pass the

    TCK (Technology Compatibility Kit) to be Java SE? No. If vendor doesn’t pay Oracle, “Java SE Compatible” 39
  24. @jeanneboyarsky Vendor JDKs •  Vulnerability Security Group •  Backporting –

    non trivial •  Features removed •  What is a bug/security patch/enhancement 40
  25. @jeanneboyarsky 41 Java 8 LTS March 2026 Java 11 LTS

    Sept 2027 Java 13 MTS March 2023 Java 15 MTS March 2023 Java 17 LTS Sept 2030 All others Free 6 months Azul Zulu
  26. @jeanneboyarsky 42 Java 8 Free Updates – Adopt OpenJDK Paid

    support - IBM March 2023+ Java 11 Free updates – Adopt OpenJDK Paid support - IBM Sept 2022+ All others Free updates – Adopt OpenJDK 6 months Adopt OpenJDK + IBM + means support as long as source maintained
  27. @jeanneboyarsky 43 RedHat •  Java 8, 9, 10 still available

    •  Java 8 and 11 supported •  Will maintain OpenJDK after Oracle support ends
  28. @jeanneboyarsky 44 Others •  Corretto – from Amazon •  SAP

    distributes Java 10 + 11 Don’t be sad if your favorite JDK is missing. Just examples!
  29. @jeanneboyarsky String name = "Jeanne”; var name = "Jeanne"; List

    list = List.of(1, 2, 3); var list = List.of(1, 2, 3); •  Syntactical sugar/less boilerplate •  Not immutable (no val) (10) 49
  30. @jeanneboyarsky List<WebElement> headers = thead.findElements(By.tagName("th")); VolunteerDashboardRow headerRow = new VolunteerDashboardRow(headers);

    vs var headers = thead.findElements(By.tagName("th")); var headerRow = new VolunteerDashboardRow(headers); (10) 51
  31. @jeanneboyarsky var csvPath = createAndGetFile(CSV_DATA); try (var csvWriter = Files.newBufferedWriter(csvPath);

    var csvPrinter = new CSVPrinter(csvWriter, CSVFormat.DEFAULT)); { } (10) 52
  32. @jeanneboyarsky Map<Integer, String> productMap1 = new HashMap<Integer, String>(); Map<Integer, String>

    productMap2 = new HashMap<>(); var productMap3 = new HashMap<Integer, String>(); (10) 53
  33. @jeanneboyarsky Where can we use? var name = "Jeanne"; var

    other = name + 2; var list = List.of(1, 2, 3); for (var num : list) {} (10) 54
  34. @jeanneboyarsky Where can’t we use? class Inner { var bad

    = "abc"; } var noGood; noGood = 4; •  Also instance variables, etc (10) 55
  35. @jeanneboyarsky (10) Pros Cons Less typing Loss of information Less

    redundancy Variable names matter more Can scan variable names Be careful! 57 http://openjdk.java.net/projects/amber/LVTIstyle.html
  36. @jeanneboyarsky Lambdas Predicate<String> pred1 = p -> true; Predicate<String> pred2

    = (String p) -> true; Predicate<String> pred3 = (var p) -> true; (11) 58
  37. @jeanneboyarsky All or nothing Good (var map, var list) ->

    true No good (var map, list) -> true (var map, List list) -> true (11) 60
  38. @jeanneboyarsky Choose your own GC •  Who cares? •  Agile.

    With releases every 6 months, features are smaller (10) 62
  39. @jeanneboyarsky Faster Default GC Java 8 Parallel Garbage Collector Java

    9 G1 GC Java 10 + 11 G1 GC with parallel implementation Java 12 G1 GC returns memory (10) For more, see https://speakerdeck.com/cguntur/garbage- collection-in-java-9 63
  40. @jeanneboyarsky Epsilon GC (11) •  Never reclaims memory •  Program

    proceeds until run out of heap •  GC never runs •  To use: •  -XX:+UseEpsilonGC •  (or) -XX:+UseNoGC 65
  41. @jeanneboyarsky Epsilon GC Good for (11) •  Performance/memory stress test

    •  Very short programs •  Last ditch performance improvements (this probably isn’t you) 66
  42. @jeanneboyarsky Z GC (11) •  Experimental •  10ms or less

    pause time •  Only for Linux/x64 •  To use, enable both: •  -XX:+UnlockExperimentalVMOptions •  -XX:+UseZGC 67
  43. @jeanneboyarsky Shenandoah GC (12) •  Experimental •  Constant pause times

    •  Parallelize work with your code •  To use, enable both: •  -XX:+UnlockExperimentalVMOptions •  -XX:+UseShenandoahGC 68
  44. @jeanneboyarsky Preview feature •  Fully implemented •  Not guaranteed to

    be forward compatible •  Must enable •  --enable-preview •  --source 12 (12) 70
  45. @jeanneboyarsky Must be ready •  Raw string literals/multi line strings

    not in java 12 •  Preview features still have criteria for release •  Goal still to avoid big changes (12) 71
  46. @jeanneboyarsky Can avoid break (12) 72 switch(rating) { case 5

    -> System.out.println("Awesome!"); case 3, 4 -> System.out.println("Good"); default -> System.out.println("Try harder"); }
  47. @jeanneboyarsky Can return value (12) 73 String message = switch(rating)

    { case 5 -> "Awesome! "; case 3, 4 -> "Good"; default -> "Try harder"; };
  48. @jeanneboyarsky String javaVersion = System.getProperty("java.version"); Runtime.Version version = Runtime.Version.parse(javaVersion); System.out.println(javaVersion

    + ": " + version.feature() + " " + version.interim() + " " + version.update() + " " + version.patch()); (10) 75
  49. @jeanneboyarsky (10) Updates Examples feature() Every 6 months 10, 11,

    12 interim() n/a for Open JDK 0 update() Within 6 months 0, 1, 2 patch() Emergencies 0, 1, 2 78
  50. @jeanneboyarsky New java launcher mode Full command Shorthand javac HelloWorld.java

    java HelloWorld java HelloWorld.java Produces class file Fully in memory For any program For programs with one class (11) 81
  51. @jeanneboyarsky Unmodifiable Collections (10) 83 Copying another Terminal operations List.copyOf

    Collectors.toUnmodifiableList Set.copyOf Collectors.toUnmodifiableSet Map.copyOf Collectors.toUnmodifiableMap
  52. @jeanneboyarsky Behind the Scenes •  Nest based access control • 

    Remove hack for private access in nested classes •  Pay off tech debt (11) 84
  53. @jeanneboyarsky Nashorn Java 11 •  Challenging to maintain •  Unclear

    adoption •  May be adopted •  Made it into Java 11 two days before cutoff (11) 85
  54. @jeanneboyarsky Tying it all together (10+11) 87 import java.nio.charset.*; public

    class Unicode { public static void main(String... args) { System.out.print("Have a \uD83C\uDF7A"); System.out.println(" or a \uD83E\uDD64"); } }