The Java SE Platform: Rebuilding Momentum | Copyright © 2011, Oracle and/or it’s affiliates. All rights reserved. | Insert Information Protection Policy Classification from Slide 8 The proceeding and following material is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Grow developer base Grow adoption Increase competitiveness Adapt to change 3 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 4 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. JDK 7 Schedule 5 2010/12/16 Feature Complete 2011/04/12 Rampdown start: P1-P3 bugs only 2011/04/28 API/interface changes: Showstoppers only 2011/05/11 All targeted bugs addressed 2011/05/18 Bug fixes: Showstoppers only 2011/06/08 Final test cycle starts 2011/07/28 General Availability | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. First release candidate built Four JSRs 1,966 Enhancements 9,494 Bug Fixes 9,018 Mercurial Changesets 147 Builds Four years, seven months, and seventeen days … 6 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Project Coin (JSR 334) InvokeDynamic (JSR 292) Fork/Join Framework (JSR 166y) NIO.2 (JSR 203) 7 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. http://www.flickr.com/photos/chefranden/908539119/ 8 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 9 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Luck Bex Script CAL Drools v-language JavaScript Yoix Lisp C# JudoScript JHCR JRuby Pascal Ada Mini BeanShell Tea Sather Dawn TermWare iScript Jython Tiger LLP Oberon Basic Tcl WebL Simkin Eiffel JESS Correlate ObjectScript Anvil Jickle SALSA PHP Groovy Logo Clojure Funnel Scheme G Smalltalk 11 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Forth Icon Processing E Scala Rexx Zigzag foo FScript Prolog Modula-2 Sleep Piccola Phobos Hojo Yassl PLAN Nice Pnuts Present Ruby = Method Calls Lots and lots and lots of ’em … 12 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 13 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. JRuby onJRuby Java 7on with InvokeDynamic Java 5/6 def foo bar end def bar baz end def baz # ... end foo JRuby call logic bar baz bar JRuby call logic Straight-through dispatch paths Kills many JVM optimizations Optimizations (like inlining) can happen! 14 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. baz InvokeDynamic (JSR 292)openjdk.java.net/projects/mlvm 15 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 17 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 1. Keep all the processor cores busy 2. Minimize synchronization overhead 3. Scale linearly as the number of cores increases 18 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 19 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Result compute(Task t) { if (t.size() < SEQUENTIAL_THRESHOLD) { return t.computeSequentially(); } else { Result left, right; left = compute(p.leftHalf()); right = compute(p.rightHalf()); return combine(left, right); } } 20 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Result compute(Task t) { if (t.size() < SEQUENTIAL_THRESHOLD) { return t.computeSequentially(); } else { Result left, right; INVOKE-IN-PARALLEL { left = compute(p.leftHalf()); right = compute(p.rightHalf()); } return combine(left, right); } } 21 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. public class Task extends java.util.concurrent.RecursiveAction { List<Student> students; static final int SEQUENTIAL_THRESHOLD = 1 << 14; Task(List<Student> ss) { students = ss; } double result; protected void compute() { if (students.size() < SEQUENTIAL_THRESHOLD) { result = computeSequentially(); } else { Task left = leftHalf(); Task right = rightHalf(); invokeAll(left, right); // INVOKE-IN-PARALLEL result = Math.max(left.result, right.result); } } Task leftHalf() { int n = students.size(); return new Task(students.subList(0, n / 2)); } Task rightHalf() { int n = students.size(); return new Task(students.subList(n / 2, n)); } double computeSequentially() { double max = Double.MIN_VALUE; for (Student s : students) { if (s.gradYear == 2011) max = Math.max(max, s.score); } return max; } 22 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. static double compute(List<Student> ss) { ForkJoinPool pool = new ForkJoinPool(); Task t = new Task(ss); pool.invoke(t); return t.result; } } Fork/Join Framework gee.cs.oswego.edu/dl/papers/fj.pdf 23 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Project Coin (JSR 334) InvokeDynamic (JSR 292) Fork/Join Framework (JSR 166y) NIO.2 (JSR 203) 24 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. New File system API File notifications Directory operations Asynchronous I/O New file system provider for zip/jar archives 25 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. import java.nio.file.*; Path searchDir = Paths.get("c:/Users"); final Path findFile = Paths.get("baby.jpg"); FileVisitor visitor = new SimpleFileVisitor() { public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { if (file.getName().startsWith(findFile)) { System.out.format("%s%n", findFile); } return FileVisitResult.CONTINUE; } }; EnumSet<FileVisitOption> opts = EnumSet.of(FileVisitOption.FOLLOW_LINKS); Files.walkFileTree(searchDir, opts, Integer.MAX_VALUE, visitor); 26 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 7 Strict class-file checking · Upgrade the class-loader architecture · Method to close a URLClassLoader · Concurrency and collections updates · Unicode 6.0 · Locale enhancement · Separate user and user-interface locales · More new I/O APIs (JSR 203) · Filesystem provider for zip/jar archives · SCTP · SDP · Windows Vista IPv6 stack · TLS 1.2 · Elliptic-curve cryptography (ECC) · JDBC 4.1 · XRender pipeline for Java 2D · New platform APIs for 6u10 graphics features · Nimbus look-and-feel for Swing · Swing JLayer component · Gervill sound synthesizer · Update the XML stack · Enhanced MBeans 27 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. JVM Convergence Copyright © 2010 Oracle and/or its affiliates. All rights reserved. Project Lambda (JSR 335) Project Jigsaw (JSR TBD) 29 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 30 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. public class Task extends java.util.concurrent.RecursiveAction { class Student { String name; int List<Student> students; gradYear; double Task(List<Student> ss) { score;} students = ss; } Task leftHalf() { int n = students.size(); return new Task(students.subList(0, n / 2)); } List<Student> students = ...; Task rightHalf() { int n = students.size(); return new Task(students.subList(n / 2, n)); } double computeSequentially() { double max = Double.MIN_VALUE; for (Student s : students) { if (s.gradYear == 2011) max = Math.max(max, s.score); } return max; } static final int SEQUENTIAL_THRESHOLD = 1 << 14; double result; protected void compute() { if (students.size() < SEQUENTIAL_THRESHOLD) { result = computeSequentially(); } else { Task left = leftHalf(); Task right = rightHalf(); invokeAll(left, right); // INVOKE-IN-PARALLEL result = Math.max(left.result, right.result); } } double max = Double.MIN_VALUE; for (Student s : students) { static double compute(List<Student> ss) { if (s.gradYear == 2011) ForkJoinPool pool = new ForkJoinPool(); Task t = new Task(ss); max = Math.max(max, s.score); pool.invoke(t); return t.result; } } return max; } 31 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. class Student { String name; int gradYear; double score;} List<Student> students = ...; double max = Double.MIN_VALUE; for (Student s : students students) { if ( s.gradYear == 2011 ) max = Math.max(max, s.score); s.score } return max; 32 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. double max = students.filter s.gradYear == 2011 .map s.score .reduce Math.max 33 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. double max = students.filter(new Predicate<Student>() { public boolean eval(Student s) { return s.gradYear == 2011 ; } }).map s.score .reduce Math.max 34 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. double max = students.filter(new Predicate<Student>() { public boolean eval(Student s) { return s.gradYear == 2011 ; } }).map(new Mapper<Student,Double>() { public Double map(Student s) { return s.score ; } }).reduce Math.max 35 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. double max = students.filter(new Predicate<Student>() { public boolean eval(Student s) { return s.gradYear == 2011 ; } }).map(new Mapper<Student,Double>() { public Double map(Student s) { return s.score ; } }).reduce(0.0, new Reducer<Double,Double>() { public Double reduce(Double max, Double score) { return Math.max(max, score); } }); 36 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. -> double max = students.filter((Student s) -> s.gradYear == 2011) .map(new Mapper<Student,Double>() { public Double map(Student s) { return s.score ; } }).reduce(0.0, new Reducer<Double,Double>() { public Double reduce(Double max, Double score) { return Math.max(max, score); } }); 37 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. double max = students.filter((Student s) -> s.gradYear == 2011) .map((Student s) -> s.score) .reduce(0.0, new Reducer<Double,Double>() { public Double reduce(Double max, Double score) { return Math.max(max, score); } }); 38 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. double max = students.filter((Student s) -> s.gradYear == 2011) .map((Student s) -> s.score) .reduce(0.0, (Double max, Double score) -> Math.max(max, score)); 39 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. double max = students.filter(s -> s.gradYear == 2011 ) .map(s -> s.score) .reduce(0.0, (max, score) -> Math.max(max, score)); 40 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. double max double max = studennew = students .filter( s ->Predicate<Student>() s.gradYear == 2011 ) { // .map( s -> s.score ) // public boolean eval(Student s) { .reduce( 0.0, Math#max Math.max ); // return s.gradYear == 2011; } }).map(new Mapper<Student,Double>() { public Double map(Student s) { return s.score; } }).reduce(0.0, new Reducer<Double,Double>() public Double reduce(Double max, Double return Math.max(max, score); } }); 41 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Iterable Iterable Double { score) { double max = students.parallel() .filter(s -> s.gradYear == 2011 ) // Iterable .map(s -> s.score) // Iterable .reduce(0.0, Math#max); // Double 42 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. List<Student> students = ...; double max = students.parallel() .filter(s -> s.gradYear == 2011 ) .map(s -> s.score) .reduce(0.0, Math#max); 43 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. interface Iterable<T> { } 44 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Iterator<T> iterator(); interface Iterable<T> { Iterator<T> iterator(); Iterable<T> filter(Predicate<? super T> predicate) ; <U> Iterable<U> map(Mapper<? super T, ? extends U> mapper) ; <U> U reduce(U base, Reducer<U, ? super T> reducer) ; } 45 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. interface Iterable<T> { Iterator<T> iterator(); Iterable<T> filter(Predicate<? super T> predicate) default Iterables.filter; <U> Iterable<U> map(Mapper<? super T, ? extends U> mapper) ; <U> U reduce(U base, Reducer<U, ? super T> reducer) ; } 46 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. interface Iterable<T> { Iterator<T> iterator(); Iterable<T> filter(Predicate<? super T> predicate) default Iterables.filter; <U> Iterable<U> map(Mapper<? super T, ? extends U> mapper) default Iterables.map; <U> U reduce(U base, Reducer<U, ? super T> reducer) ; } 47 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. interface Iterable<T> { Iterator<T> iterator(); Iterable<T> filter(Predicate<? super T> predicate) default Iterables.filter; <U> Iterable<U> map(Mapper<? super T, ? extends U> mapper) default Iterables.map; <U> U reduce(U base, Reducer<U, ? super T> reducer) default Iterables.reduce; } 48 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Project Lambda = Lambda expressions + Bulk-data operations + Method literals + Default methods 49 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 50 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Project Lambda (JSR 335) openjdk.java.net/projects/lambda 51 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Project Lambda (JSR 335) Project Jigsaw (JSR TBD) 52 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 53 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. http://www.flickr.com/photos/lizadaly/29443 62379 org.planetjdk.aggregator joda-time jdom rome-fetcher jaxen rome saxpath tagsoup 54 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jaxp mvn 55 // module-info.java jar module org.planetjdk.aggregator @ 1.0 { requires jdom @ 1.0; requires tagsoup @ 1.2; requires rome @ 1.0; requires rome-fetcher @ 1.0; requires joda-time @ 1.6; requires jaxp @ 1.4.4; class org.openjdk.aggregator.Main; } jmod | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. rpm deb http://www.flickr.com/photos/viagallery/229 0654438 56 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jdk jre java headless corba scripting txn jdbc xml-dsig kerberos deploy tools jre-tools jaxws-tools jaxws management javap desktop javah javadoc jaxp javac naming rmi compiler auth ssl logging base 57 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jdk jre java headless corba scripting txn jdbc xml-dsig kerberos deploy tools jre-tools jaxws-tools jaxws management javap desktop javah javadoc jaxp javac naming rmi compiler auth ssl logging base 58 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jdk jre java headless corba scripting txn jdbc xml-dsig kerberos deploy tools jre-tools jaxws-tools jaxws management javap desktop javah javadoc jaxp javac naming rmi compiler auth ssl logging base 59 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jdk jre java headless corba scripting txn jdbc xml-dsig kerberos deploy tools jre-tools jaxws-tools jaxws management javap desktop javah javadoc jaxp javac naming rmi compiler auth ssl logging base 60 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jdk jre java headless corba scripting txn jdbc xml-dsig kerberos deploy tools jre-tools jaxws-tools jaxws management javap desktop javah javadoc jaxp javac naming rmi compiler auth ssl javafx logging base 61 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jdk jre java headless corba scripting txn jdbc xml-dsig kerberos deploy tools jre-tools jaxws-tools jaxws management javap desktop javah javadoc jaxp javac naming rmi compiler auth ssl logging base 62 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jdk jre java headless corba scripting txn jdbc xml-dsig kerberos deploy tools jre-tools jaxws-tools jaxws management javap desktop javah javadoc jaxp javac naming rmi compiler auth ssl logging base 63 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jdk jre java headless corba scripting txn jdbc xml-dsig kerberos deploy tools jre-tools jaxws-tools jaxws management javap desktop javah javadoc jaxp javac naming rmi compiler auth ssl logging base 64 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jdk jre java headless corba scripting txn jdbc xml-dsig kerberos deploy tools jre-tools jaxws-tools jaxws management javap desktop javah javadoc jaxp javac naming rmi compiler auth ssl logging base 65 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jdk jre java headless corba scripting txn jdbc xml-dsig kerberos deploy tools jre-tools jaxws-tools jaxws management javap desktop javah javadoc jaxp javac naming rmi compiler auth ssl logging base 66 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jdk jre java headless corba scripting txn jdbc xml-dsig kerberos deploy tools jre-tools jaxws-tools jaxws management javap desktop javah javadoc jaxp javac naming rmi compiler auth ssl logging base 67 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. jdk jre java headless corba scripting txn jdbc xml-dsig kerberos deploy tools jre-tools jaxws-tools jaxws management javap desktop javah javadoc jaxp javac naming rmi compiler auth ssl logging base 68 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 69 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 70 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Project Jigsaw openjdk.java.net/projects/jigsaw 71 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Project Lambda (JSR 335) Project Jigsaw (JSR TBD) 72 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Project Lambda (JSR 335) Project Jigsaw (JSR TBD) 73 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. JavaScript (Project Nashorn) JVM Convergence Type Annotations (JSR 308) Date/Time API (JSR 310) Sensors Plus more to come … Self-Tuning JVM Improved Native Integration Big Data Reification Tail Calls/Continuations Meta-Object Protocol Multi-Tenancy Resource Management Heterogeneous Compute Models 74 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. JDK Roadmap NetBeans 7 •Java SE 7 Support •more JDK 7u2 •JRE 7 on java.com •JavaFX 2.0 co-install JDK 7 2011 JDK 7u6 Last Public JDK 6 Update NetBeans.next •Java SE 8 Support •JavaFX 3.0 Support •more 2013 2012 2014 Mac OS X JDK 7u4 JDK 8 •JDK 7 Developer Preview •OS X JDK Port (for developers) •Windows, Linux, Solaris, OS X, Embedded Platforms •Jigsaw •Lambda •JavaFX 3.0 •Complete Oracle JVM Convergence •JavaScript Interop •more •Java FX 2.0 Dev Preview NetBeans 7.1 •JavaFX 2.0 Support 75 •OS X JRE Port (for end-users) •Improved OS integration, autoupdate | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. 76 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. openjdk.java.net/projects/jdk8 jdk8.java.net 77 | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. | Copyright © 2011, Oracle and/or it’s affiliates. All rights reserved. | Insert Information Protection Policy Classification from Slide 8