Your SlideShare is downloading. ×
0
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Java, Moving Forward
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Java, Moving Forward

812

Published on

the Topics in JavaSE8 and some of Key features in JavaEE7.

the Topics in JavaSE8 and some of Key features in JavaEE7.

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
812
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
37
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. JAVA, MOVING FORWARD JavaSE8 & JavaEE7 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 2. JavaOne Tokyo 2012 April 4-52 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 3. the Coming Technologies3 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 4. the Coming Technologies JavaSE8 Project Jigsaw Project Lambda HotRockit Nashorn3 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 5. the Coming Technologies JavaSE8 JavaEE7 Project Jigsaw PaaS Project Lambda JAX-RS 2.0 HotRockit JCache Nashorn3 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 6. JavaSE8 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 7. JavaSE Roadmap 2011 2012 2013 2011/7/28 2012 later 2013 Summer JavaSE7 JavaSE7u6 JavaSE8 JRE for MacOSX Jigsaw 2012/4/27 Auto-update Lambda JavaFX3.0 JavaSE7u4 HotRockit JDK for MacOSX Nashorn JavaFX2.1 2012/11 G1GC JRE default JavaSE6 Last public update5 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 8. Themes of JavaSE8 (from JSR 337)6 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 9. Themes of JavaSE8 (from JSR 337) Productivity6 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 10. Themes of JavaSE8 (from JSR 337) Productivity Performance6 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 11. Themes of JavaSE8 (from JSR 337) Productivity Performance Modularity6 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 12. JavaSE8 Project Jigsaw Project Lambda HotRockit Nashorn7 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 13. Project Jigsaw8 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 14. Project Jigsaw No more classpath8 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 15. Project Jigsaw No more classpath Escape from “JAR hell” Modular JDK8 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 16. module-info.java com.foo com.foo.Main module com.foo {} com.foo.Sub com.foo.util.Tool9 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 17. requires com.foo module com.foo { com.foo.Main requires org.bar; com.foo.Sub requires com.baz; } com.foo.util.Tool org.bar com.baz10 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 18. @ version module com.foo @ 1.0.0 { requires org.bar @ 1.2.0; com.foo requires com.baz @ 0.8-beta; } org.bar com.baz11 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 19. permits com.app module com.foo { permits com.app; requires org.bar; requires com.baz; com.foo } org.bar com.baz12 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 20. permits com.other com.app module com.foo { permits com.app; requires org.bar; requires com.baz; com.foo } org.bar com.baz12 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 21. permits com.other com.app module com.foo { permits com.app; requires org.bar; requires com.baz; com.foo } org.bar com.baz12 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 22. optional module com.foo { requires org.bar; requires com.baz; requires optional org.bar.extra; } com.foo org.bar.extra org.bar com.baz13 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 23. optional module com.foo { requires org.bar; requires com.baz; requires optional org.bar.extra; } com.foo org.bar.extra org.bar com.baz13 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 24. provides module com.app { requires com.foo.util; requires com.foo.db; } com.app module com.foo.lib { provides com.foo.util; provides com.foo.db; com.foo.lib } com.foo.lib.util com.foo.lib.db14 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 25. jpkg $ jpkg -m modules/com.foo jmod com.foo $ ls modules/ com.foo@1.0.0.jmod com.foo15 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 26. jmod (1) $ jmod -L mlib create $ jmod -L mlib install /path/to/com.foo@*.jmod /path/to/com.app@*.jmod $ jmod -L mlib ls com.app com.foo@1.0.0 com.app@0.8-beta $ java -L mlib -m com.app com.foo16 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 27. jmod (2) $ jmod add-repo http://jig.sfbay $ jmod install jdk.tools http://jig.sfbay jdk.tools@8.0.0.jmod jdk.jndi@8.0.0.jmod17 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 28. JavaSE8 Project Jigsaw Project Lambda HotRockit Nashorn18 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 29. Project Lambda19 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 30. Project Lambda19 ! Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 31. Project Lambda !19 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 32. Project Lambda ! Easy-to-use Parallel19 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 33. Project Lambda ! Easy-to-use Parallel Reduce conceptual and syntactic GAP between Serial and Parallel expressions19 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 34. class Student public class Student { private int gradYear; private double score; public int getGradYear() { return gradYear; } public void setGradYear(int gradYear) { this.gradYear = gradYear; } public double getScore() { return score; } public void setScore(double score) { this.score = score; } }20 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 35. Question21 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 36. Question Compute the highest score of the students graduated in 201121 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 37. Highest Score with External Iteration List<Student> students = new ArrayList<>(); // ... double hightestScore = 0.0; for (Student s : students) { if (s.getGradYear() == 2011) { if (s.getScore() > hightestScore) { hightestScore = s.getScore(); } } }22 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 38. Highest Score with Internal Iteration SmartList<Student> students = new SmartList<>(); // ... double hightestScore = students .filter(new Predicate<Student>() { @Override public boolean eval(Student s) { return s.getGradYear() == 2011; }}) .map(new Mapper<Student, Double>() { @Override public Double map(Student s) { return s.getScore(); }}) .max();23 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 39. Highest Score with Internal Iteration SmartList<Student> students = new SmartList<>(); // ... double hightestScore = students .filter(new Predicate<Student>() { @Override public boolean eval(Student s) { return s.getGradYear() == 2011; }}) .map(new Mapper<Student, Double>() { @Override public Double map(Student s) { return s.getScore(); }}) .max();23 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 40. with Lambdas List<Student> students = new ArrayList<>(); // ... double hightestScore = students .filter((Student s) -> s.getGradYear() == 2011) .map((Student s) -> s.getScore()) .max();24 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 41. with Lambdas and Parallelism List<Student> students = new ArrayList<>(); // ... double hightestScore = students .filter((Student s) -> s.getGradYear() == 2011) .map((Student s) -> s.getScore()) .max();24 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 42. with Lambdas and Parallelism List<Student> students = new ArrayList<>(); // ... double hightestScore = students.parallel() .filter((Student s) -> s.getGradYear() == 2011) .map((Student s) -> s.getScore()) .max();24 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 43. the Points25 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 44. the Points Lambda Expression25 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 45. the Points Lambda Expression Default Method25 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 46. the Points Lambda Expression Default Method New Interface: ParallelIterable25 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 47. Functional Interface26 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 48. Functional Interface Functional interface:26 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 49. Functional Interface Functional interface: Interface with one method26 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 50. Functional Interface Functional interface: Interface with one method java.util.Comparator<T> java.io.FileFilter java.lang.Runnable java.awt.event.ActionListener ...26 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 51. Lambda Expression Lambda Expression instantiates a fuctional interface27 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 52. Lambda Expression Lambda Expression instantiates a fuctional interface Comparator<String> c = (String x, String y) -> x.length() - y.length();27 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 53. Lambda Expression Lambda Expression instantiates a fuctional interface Comparator<String> c = (String x, String y) -> x.length() - y.length(); Comparator<String> c = new Comparator<String>() { = @Override public int compare(String x, String y) { return x.length() - y.length(); }};27 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 54. Dilemma Collections need new methods forEach reduce filter sorted map ...28 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 55. Dilemma Collections need new methods forEach reduce filter sorted map ... Compatibility?28 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 56. Default Method29 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 57. Default Method Interface method with default implementation29 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 58. Default Method Interface method with default implementation public interface Iterable<T> { Iteratr<T> iterator(); Iterable<T> filter(Predicate<? super T> predicate) default { return Iterables.filter(this, predicate); } void forEach(Block<? super T> block) default { Iterables.forEach(this, block); } // ... }29 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 59. New Interface: ParallelIterable ParallelIterable has the same methods as Iterable, except in parallel. forEach reduce filter sorted map ... interface Collection<T> { Collection new method // ... ParallelIterable<T> parallel(); parallel() }30 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 60. Method Reference FileFilter filter = new FileFilter() { public boolean accept(File f) { return f.canRead(); } };31 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 61. Method Reference FileFilter filter = new FileFilter() { public boolean accept(File f) { return f.canRead(); } }; FileFilter filter = (File f) -> f.canRead();31 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 62. Method Reference FileFilter filter = new FileFilter() { public boolean accept(File f) { return f.canRead(); } }; FileFilter filter = (File f) -> f.canRead(); FileFilter filter = File#canRead;31 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 63. Highest Score with Lambdas List<Student> students = new ArrayList<>(); // ... double hightestScore = students.parallel() .filter(s -> s.getGradYear() == 2011) .map(Student#getScore()) .max();32 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 64. JavaSE8 Project Jigsaw Project Lambda HotRockit Nashorn33 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 65. Oracle JVMs34 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 66. Oracle JVMs HotSpot from Sun34 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 67. Oracle JVMs JRockit HotSpot from BEA from Sun34 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 68. Oracle JVMs JRockit HotSpot from BEA from Sun34 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 69. Oracle JVMs JRockit HotSpot from BEA from Sun HotRockit34 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 70. JRockit35 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 71. JRockit jcmd no Perm-Gen Mission Control Flight Recorder Deterministic GC35 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 72. JRockit jcmd no Perm-Gen Mission Control (Premium Feature) Flight Recorder (Premium Feature) Deterministic GC (Premium Feature)35 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 73. JavaSE8 Project Jigsaw Project Lambda HotRockit Nashorn36 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 74. Nashorn New JavaScript Engine in JDK8 Compliance: ECMA-262 Edition 5 (Latest ECMAScript standard) JavaScript & Java call each other37 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 75. Native on the JVM AST/IR Java JavaScript Abstract Syntax Tree Intermediate Representation byte code InvokeDynamic uses MethodHandle38 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 76. JavaEE7 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 77. JavaEE Roadmap 2009 2010 2011 2012 2013 2009/12/10 2013 Q2 JavaEE6 JavaEE7 Extensibility Provisioning Profile 2011/2/28 Elasticity Pruning Multi-tenancy Glassfish Orchestration Server 3.1 Clustering Glassfish Glassfish v3 JavaEE6 support Server 4 JavaEE7 support40 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 78. Themes of JavaEE7 (from JSR 342)41 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 79. Themes of JavaEE7 (from JSR 342) Cloud41 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 80. JavaEE7 PaaS JAX-RS 2.0 JCache42 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 81. Platform as a Service the JavaEE7 Platform is a Service43 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 82. [IPS]aaS IaaS Infrastructure as a Service PaaS Platform as a Service SaaS Software as a Service44 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 83. [IPS]aaS IaaS Infrastructure as a Service PaaS Platform as a Service SaaS Software as a Service Application Middleware OS HW/NW44 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 84. [IPS]aaS IaaS Infrastructure as a Service PaaS Platform as a Service SaaS Software as a Service Application Application Middleware Middleware OS OS HW/NW HW/NW44 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 85. [IPS]aaS IaaS Infrastructure as a Service PaaS Platform as a Service SaaS Software as a Service Application Application Application Middleware Middleware Middleware OS OS OS HW/NW HW/NW HW/NW44 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 86. Key Features45 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 87. Key Features Provisioning45 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 88. Key Features Provisioning Elasticity45 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 89. Key Features Provisioning Elasticity Multi-tenancy45 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 90. Provisioning Auto-Provision Services Application Cloud Administration Service Messaging LDAP Service Service Database Application Provision and Initialize Service Container Application Dependencies46 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 91. Elasticity Dynamic self-adjusting SLA driven Elasticity Node Node Node Node47 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 92. Multi-tenancy Shared Application, Shared Data Source Tenant 1 Tenant 2 Application Data Source Tenant 3 @TenantId48 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 93. JavaEE7 PaaS JAX-RS 2.0 JCache49 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 94. JAX-RS 2.0 javax.ws.rs JAX-RS Java API for RESTful web services version 1.1 is a part of JavaEE650 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 95. JAX-RS Client Server Resource A Resource B51 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 96. JAX-RS GET Client POST Server PUT DELETE Resource A Resource B51 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 97. JAX-RS GET Client POST Server PUT DELETE Resource A text Resource json B xml byte-stream51 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 98. JAX-RS GET Client POST Server PUT Object DELETE Resource A A Object text Resource B json B xml byte-stream51 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 99. Define a Resource 1.1 JAX-RS http://example.info/company/1234/employee?id=567852 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 100. Define a Resource 1.1 JAX-RS http://example.info/company/1234/employee?id=5678 @Path("/company/{companyId}") public class CompanyResource { @GET @Path("/employee") @Produces(MediaType.TEXT_PLAIN) public String employee( @PathParam("companyId") String companyId, @QueryParam("id") String employeeId) { return findEmployee(companyId, employeeId); } // ... }52 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 101. What’s new in JAX-RS 2.0 Client API Improved Conneg Filters & Interceptors Hypermedia Asynchrony Validation JSR-339: Early Draft Review 3 on 07 June, 201253 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 102. Client API Client client = ClientFactory.newClient(); String employeeName = client .target("http://../campany/{campanyId}/employee") .pathParam("campanyId", "1234") .queryParam("id", "5678") .request(MediaType.TEXT_PLAIN) .get(String.class);54 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 103. Filters Resource A Resource B55 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 104. Filters Request Resource A Resource B55 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 105. Filters Request Resource A Response Resource B55 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 106. Filters Request Resource A Response Resource B55 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 107. Filters Request Resource A Response Resource B Response55 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 108. Filters Request PreMatchFilter (server side only) Filter 1 Resource A Response Resource B Response55 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 109. Filters Request PreMatchFilter (server side only) Filter 1 RequestFilter Filter 2 Filter 3 Resource A Response Filter 2 Filter 3 Resource B Response55 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 110. Filters Request PreMatchFilter (server side only) Filter 1 RequestFilter Filter 2 Filter 3 Resource A Response Filter 5 Filter 4 ResponseFilter Filter 2 Filter 3 Resource B Response55 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 111. Interceptors @Consumes ("application/widget+xml") MessageBodyReader <Widget> Resource A @Produces ("application/widget+xml") MessageBodyWriter <Widget>56 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 112. Interceptors Request @Consumes ("application/widget+xml") MessageBodyReader <Widget> Resource A @Produces ("application/widget+xml") MessageBodyWriter <Widget>56 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 113. Interceptors Request @Consumes ("application/widget+xml") MessageBodyReader <Widget> Widget Resource A @Produces ("application/widget+xml") MessageBodyWriter <Widget>56 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 114. Interceptors Request @Consumes ("application/widget+xml") MessageBodyReader <Widget> Widget Resource A @Produces ("application/widget+xml") MessageBodyWriter <Widget> Widget56 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 115. Interceptors Request @Consumes ("application/widget+xml") MessageBodyReader <Widget> Widget Resource A Response @Produces ("application/widget+xml") MessageBodyWriter <Widget> Widget56 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 116. Interceptors Request ReaderInterceptor <Widget> @Consumes ("application/widget+xml") MessageBodyReader <Widget> Widget Resource A Response WriterInterceptor @Produces <Widget> ("application/widget+xml") MessageBodyWriter <Widget> Widget56 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 117. Asynchrony (server side) Suspend & Resume connections javax.ws.rs.core.ExecutionContext @Path("/async/longRunning") public class MyResource { @Context ExecutionContext ctx; @GET @Produces("text/plain") public void longRunningOp() { Executors.newSingleThreadExecutor().submit(new Runnable() { public void run() { executeLongRunningOp(); ctx.resume("Hello async world!"); }}); ctx.suspend(); } }57 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 118. Asynchrony (client side) AsyncInvoker AsyncInvoker async = client .target("http://.../campany/{campanyId}/employee") .pathParam("campanyId", "1234") .queryParam("id", "5678") .request(MediaType.TEXT_PLAIN) .async(); // Future<Response> Future<Response> fresponse = async.get(); // InvocationCallback<T> Future<String> fstring = async.get(new InvocationCallback<String>(){ @Override public void completed(String response) { /* ... */ } @Override public void failed(ClientException error) { /* ... */ } });58 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 119. JavaEE7 PaaS JAX-RS 2.0 JCache59 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 120. JCache javax.cache Standard Caching API60 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 121. JCache javax.cache Standard Caching API Expiration Mutual exclusion Spooling Consistency60 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 122. Basic Use CacheManager cacheManager = Caching.getCacheManager(); Cache<Integer, String> cache = cacheManager.getCache("example"); if (cache == null) { cache = cacheManager .<Integer, String>createCacheBuilder("example") .setExpiry(ExpiryType.MODIFIED, new Duration(TimeUnit.SECONDS, 300L)) .build(); } Integer key = Integer.valueOf(1); String value = "val1"; cache.put(key, value); String value2 = cache.get(key);61 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 123. Atomic Operation cache.getAndRemove(key); cache.getAndReplace(key, value2); cache.putIfAbsent(key, value); cache.replace(key, value); cache.replace(key, value, value2);62 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 124. Annotation @CacheDefaults(cacheName="myScheduler") public class MyScheduler { @CachePut public void create( @CacheKeyParam String id, @CacheValue Schedule schedule) { /* ... */ } @CacheResult public Schedule get(String id) { /* ... */ } @CacheRemoveEntry public void remove(String id) { /* ... */ } }63 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 125. Conclusion Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 126. Conclusion65 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 127. Conclusion Revolution is coming, Don’t miss it!65 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 128. JavaOne 2012 Sept 30-Oct 466 Copyright © 2012 Akira Koyasu. Some rights reserved.
    • 129. Notes This work is licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/ licenses/by-nc/3.0/.67 Copyright © 2012 Akira Koyasu. Some rights reserved.

    ×