Tech Days 2010

1,890 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
1,890
On SlideShare
0
From Embeds
0
Number of Embeds
157
Actions
Shares
0
Downloads
22
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Tech Days 2010

  1. 1. Tech Days 2010 from Oracle Luqman Shareef www.luqmanshareef.com [email_address] March 24-25 2010 Hyderabad
  2. 2. The event <ul><li>Ravichandra Kulur and band kick started the event, with flute, guitar, keyboard and drums </li></ul>Krishna Dhawan, Managing Director, Oracle India talked about the re-enforced commitment to Java.
  3. 4. Technology showcase: Be inspired <ul><li>Demos on Day 1 </li></ul><ul><ul><li>Teleporting - a new feature in Virtual Box </li></ul></ul><ul><ul><ul><li>A running Virtual Machine can be moved between different hosts across different architectures, different Operating Systems etc. </li></ul></ul></ul><ul><ul><li>A cool drawing tool in JavaFX </li></ul></ul><ul><li>Demos on Day 2 </li></ul><ul><ul><li>Java EE 6 </li></ul></ul><ul><ul><li>JavaFx </li></ul></ul><ul><ul><ul><li>For Desktop, for mobile and for TV </li></ul></ul></ul>04/05/10
  4. 5. James Gosling, Father of Java gave an overview of the Java ecosystem. To run through his slides James was using an application that he developed using JavaFX
  5. 6. From James presentation… <ul><li>15 million JDK downloads / week </li></ul><ul><li>10 billion Java devices (more than number of humans on earth) </li></ul><ul><ul><li>5.5 billion smart cards </li></ul></ul><ul><ul><li>2.6 billion mobile devices </li></ul></ul><ul><ul><li>100 million Java TV devices </li></ul></ul><ul><ul><li>Gizmos </li></ul></ul><ul><li>6.5+ million Java developers </li></ul><ul><li>Most college grads have taken a Java course – Worldwide. “Learn once, work anywhere” </li></ul>
  6. 7. What’s new in JDK 7 <ul><li>Modularity – JDK is getting bigger and bigger with the addition of new APIs. It is ought to be modularized. </li></ul><ul><ul><li>Project Jigsaw : The goal of this Project is to design and implement a simple, low-level module system focused narrowly upon the goal of modularizing the JDK, and to apply that system to the JDK itself. </li></ul></ul><ul><ul><li>http://openjdk.java.net/projects/jigsaw/ </li></ul></ul><ul><li>Dynamic language support – The magic is in the virtual machine. Supports lots of scripting languages. </li></ul><ul><ul><li>Ex: Scala, Ruby, Groovy, Pyhon, Javascript etc. </li></ul></ul><ul><li>G1 (Garbage First) Garbage collector. </li></ul><ul><li>NIO2 (New IO </li></ul><ul><ul><li>Improving performance of very large scale app services </li></ul></ul><ul><li>Compressed pointers. </li></ul><ul><ul><li>32G == 4G </li></ul></ul><ul><ul><li>32 G Address space gives same performance as 4G Space </li></ul></ul>
  7. 8. Java EE 6 (From Arun Gupta’s presentation)
  8. 9. Java EE 6 Contd…
  9. 10. Java EE 6 Contd…
  10. 11. Goals for the Java EE 6 Platform <ul><li>Flexible & Light-weight </li></ul><ul><li>Extensible </li></ul><ul><ul><li>Embrace Open Source Frameworks </li></ul></ul><ul><li>Easier to use, develop on </li></ul><ul><ul><li>Continue on path set by Java EE 5 </li></ul></ul>
  11. 12. What’s new in JEE 6? (Spec released in Dec 2009) <ul><li>Includes </li></ul><ul><ul><li>EJB 3.1, JPA 2.0, Servlets 3.0, JAX-RS 1.1, JSF 2.6, JAX-WS 2.2, Interceptors 1.1, etc. </li></ul></ul><ul><li>Pluggability / Extensibility – Create a playing field for third-party applications. </li></ul><ul><li>Web profile – A fully functional, mid-size stack for modern web development. </li></ul><ul><li>Dependency Injection – Uses the annotation facility to achieve this. </li></ul><ul><li>GlassFish 3.0 is the reference implementation of JEE6. </li></ul>
  12. 13. Java EE 6 Web Profile 1.0 <ul><li>Fully functional mid-sized profile </li></ul><ul><ul><li>Actively discussed in the Java EE 6 Expert Group and outside it. </li></ul></ul><ul><ul><li>Technologies in web profile </li></ul></ul>Servlets 3.0 JSP 2.2 EL 2.2 JSTL 1.2 EJB 3.1 Lite JTA 1.1 JPA 2.0 Bean Validation 1.0 Managed Beans 1.0 JSF 2.0 Common Annotations 1.1 Interceptors 1.1 Context & Dependency Injection 1.0
  13. 14. Java EE 6 is Lightweight <ul><li>Pruning </li></ul><ul><ul><li>Make some technologies optional </li></ul></ul><ul><li>Pruned today, means </li></ul><ul><ul><li>Optional in the next release </li></ul></ul><ul><ul><li>Deleted in the subsequent releases </li></ul></ul><ul><li>Technologies marked in Javadocs </li></ul><ul><ul><li>JAX-RPC, EJB 2.x Entity Beans, JAXR, JSR 88 </li></ul></ul>
  14. 15. Java EE 6 is Extensible <ul><li>Embrace open source frameworks </li></ul><ul><ul><li>Wicket, Lift, Spring, Struts, ... </li></ul></ul><ul><li>Zero-configuration, drag-and-drop for web frameworks </li></ul><ul><ul><li>Servlets, servlet filters, context listeners for a framework get discovered and registered automatically </li></ul></ul><ul><li>Plug-in libraries using web fragments </li></ul>
  15. 16. Glassfish V3
  16. 17. Glassfish is <ul><li>A community </li></ul><ul><ul><li>Users, Partners, Testers, Developers, ... </li></ul></ul><ul><ul><li>Started in 2005 on java.net </li></ul></ul><ul><li>An application Server </li></ul><ul><ul><li>Open Source (CDDL & GPL v2) </li></ul></ul><ul><ul><li>Java EE Reference Implementation </li></ul></ul>
  17. 18. CLI-based Administration <ul><li>“ asadmin” CLI utility </li></ul><ul><li>Administrative commands can be added with each container </li></ul>Available as : asadmin myCommand –s1 foo –s2 bar @Service(name=”myCommand”) public class ChangeRandomCtr implements AdminCommand { @Param String s1; @Param String s2; … }
  18. 19. Glassfish REST Interface <ul><li>REST interface to management and monitoring data </li></ul><ul><li>Configuration data, commands invocation, (start/stop instance, deploy, undeploy, ...), CRUD resources (JMS, JDBC, ...) </li></ul><ul><ul><ul><li>localhost:4848/management/domain </li></ul></ul></ul><ul><ul><ul><li>localhost:4848/monitoring/domain </li></ul></ul></ul><ul><li>GET, POST, DELETE methods </li></ul><ul><li>XML, JSON, HTML reps </li></ul>
  19. 20. Oracle said .. <ul><li>“ GlassFish joins WebLogic Server in the best Java EE application server offering in the industry” </li></ul><ul><li>“ GlassFish continues as the Java EE RI and as an open source project.” </li></ul><ul><li>“ Oracle plans to add GlassFish Enterprise Server to all WebLogic offerings.” </li></ul><ul><li>“ GlassFish also available as standalone offering.” </li></ul>http://blogs.sun.com/arungupta/entry/glassfish_strategy_by_oracle_sun
  20. 21. Java FX
  21. 22. What is JavaFX? <ul><li>It is Scripting Language to create rich media and content </li></ul><ul><li>It is a declarative scripting language for GUI </li></ul><ul><li>It Runs on JVM </li></ul><ul><li>It utilizes Java class libraries </li></ul><ul><li>The JavaFX Platform </li></ul><ul><ul><li>A rich client platform for crossscreen rich internet applications (RIA) and content </li></ul></ul><ul><ul><li>Contains 2D graphics, Animation, Text and Media. </li></ul></ul><ul><ul><li>Contains device specific elements for desktop, mobile and TV </li></ul></ul>04/05/10 Compile javafxc script.fx Run javafx script
  22. 23. JavaFX Platform 04/05/10
  23. 24. Some JavaFX APIs <ul><li>javafx.scene.geometry </li></ul><ul><ul><li>Circle, Polygon, Arch, Eclipse, MoveTo, … </li></ul></ul><ul><li>javafx.scene.paint </li></ul><ul><ul><li>Color, Paint, … </li></ul></ul><ul><li>javafx.animation </li></ul><ul><ul><li>Interpolatable, Interpolator, </li></ul></ul><ul><ul><li>KeyFrame, Timeline … </li></ul></ul>04/05/10 Example import javafx.scene.geometry.*; import javafx.scene.paint.*; Ellipse { centerX: 50 centerY: 50 radiusX: 50 radiusY: 25 fill: Color.BLACK }
  24. 25. Performance Tuning Garbage Collection 04/05/10
  25. 26. Garbage Collection <ul><li>JVM Options </li></ul><ul><ul><li>Standard options : Work in all platforms </li></ul></ul><ul><ul><li>-X options : May not work in some platforms </li></ul></ul><ul><ul><li>-XX options : May not work in some platforms & May need additional privileges to use </li></ul></ul><ul><ul><li>(There are more than 400 –XX options in Java 6 JRE) </li></ul></ul><ul><li>Three different Garbage Collectors </li></ul><ul><ul><li>Serial Collector </li></ul></ul><ul><ul><li>Parallel Collector </li></ul></ul><ul><ul><li>Concurrent Collector </li></ul></ul>04/05/10
  26. 27. Serial vs. Parallel Vs. Concurrent GC <ul><li>Serial Collector </li></ul><ul><ul><li>Uses single thread to perform GC. </li></ul></ul><ul><ul><li>Suited to most desktop applications </li></ul></ul><ul><ul><li>Can be enabled with the option -XX:+UseSerialGC </li></ul></ul><ul><li>Parallel Collector </li></ul><ul><ul><li>Also known as throughput collector </li></ul></ul><ul><ul><li>Performs minor collections in parallel </li></ul></ul><ul><ul><li>Suited for applications running on multiprocessor or multi-threaded hardware </li></ul></ul><ul><ul><li>Can be enabled with the option -XX:++UseParallelGC </li></ul></ul><ul><li>Concurrent Collector </li></ul><ul><ul><li>Performs most of its work concurrently (while the application is still running) </li></ul></ul><ul><ul><li>Keeps the Garbage Collection pauses short </li></ul></ul><ul><ul><li>Suited for applications for which response time is more important than overall throughput </li></ul></ul><ul><ul><li>Can be enabled with the option -XX:++UseConcMarkSweepGC </li></ul></ul>04/05/10
  27. 28. Memory pools for HotSpot JVM <ul><li>A  memory pool  represents a memory area that the JVM manages. </li></ul><ul><li>Eden Space (heap) </li></ul><ul><ul><li>Pool from which memory is initially allocated for most objects. </li></ul></ul><ul><li>Survivor Space (heap) </li></ul><ul><ul><li>Pool containing objects that have survived GC of eden space. </li></ul></ul><ul><li>Tenured Generation (heap) </li></ul><ul><ul><li>Pool containing objects that have existed for some time in survivor space. </li></ul></ul><ul><li>Permanent Generation (non-heap) </li></ul><ul><ul><li>Holds all the reflective data of the virtual machine itself, such as class and method objects. With JVMs that use class data sharing, this generation is divided into read-only and read-write areas. </li></ul></ul>04/05/10
  28. 29. HotSpot VM Heap Layout 04/05/10
  29. 30. Garbage First (G1) GC <ul><li>It is new GC that is being introduced in the Java HotSpot VM in JDK 7. </li></ul><ul><li>Experimental version of G1 has been released in Java SE 6 Update 14. </li></ul><ul><li>It is a replacement of CMS (Concurrent Mark Sweep) GC. </li></ul><ul><li>Features of G1 </li></ul><ul><ul><li>Server style GC </li></ul></ul><ul><ul><li>Parallel and Concurrent </li></ul></ul><ul><ul><li>Generational </li></ul></ul><ul><ul><li>Compacting (Not available in CMS) </li></ul></ul><ul><ul><li>Predictable (Not available in CMS) </li></ul></ul><ul><li>Can be enabled with the following two parameters </li></ul><ul><ul><li>-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC </li></ul></ul>04/05/10
  30. 31. Hints for GC tuning <ul><li>GC Nirvana </li></ul><ul><ul><li>Low GC overhead </li></ul></ul><ul><ul><li>Low GC pause times </li></ul></ul><ul><ul><li>Good space efficiency </li></ul></ul><ul><li>Unfortunately, reality is you must choose any two out of the above three options. </li></ul>04/05/10
  31. 32. JPA 2.0 04/05/10 http://blogs.sun.com/arungupta/entry/day_2_tech_days_2010
  32. 33. JPA 2.0 (JSR 317) <ul><li>Part of Java EE 6 and/or available standalone </li></ul><ul><li>More sophisticated mapping and modeling options added. </li></ul><ul><li>Expanded query language </li></ul><ul><li>Adds Criteria API, together with Metamodel API </li></ul><ul><li>Support for Validation </li></ul><ul><li>EclipseLink is reference implementation </li></ul><ul><li>Integrated in GlassFish </li></ul>04/05/10
  33. 34. What is new in JPA 2.0? <ul><li>Element collections </li></ul><ul><li>Embeddable classes </li></ul><ul><li>Persistently ordered lists </li></ul><ul><li>Improved Map support </li></ul><ul><li>More relationship mapping options </li></ul><ul><li>Criteria API </li></ul><ul><li>Metamodel API </li></ul><ul><li>Validation Support </li></ul><ul><li>Pessimistic Locking </li></ul><ul><li>Caching Configuration </li></ul>04/05/10
  34. 35. Element Collection and Embeddable classes <ul><li>Element collections </li></ul><ul><ul><li>Collections of strings, integers, floats, decimals etc </li></ul></ul><ul><ul><li>Collections of embeddable classes </li></ul></ul><ul><li>Embeddable classes </li></ul><ul><ul><li>Nested embeddables; embeddables with relationships </li></ul></ul>04/05/10 @Entity public class Person { @Id protected String ssn; protected String name; protected Date birthDate; . . . @ElementCollection protected Set<String> nickNames; } @Embeddable public class Address { String street; String city; . . . } @Entity public class RichPerson extends Person { . . . @ElementCollection protected Set<Address> vacationHomes; . . . }
  35. 36. Java Persistence Query Language <ul><li>String-based SQL-like query language </li></ul><ul><ul><li>SELECT, FROM, WHERE, GROUP BY, ORDER BY,… </li></ul></ul><ul><li>Queries written over Java domain model </li></ul><ul><ul><li>Entities, state, relationships </li></ul></ul><ul><ul><li>Supports navigation using dot-notation </li></ul></ul><ul><ul><li>Mapped into SQL by the provider </li></ul></ul><ul><li>Supports static and dynamic use </li></ul><ul><ul><li>SELECT AVG (p.price) </li></ul></ul><ul><ul><li>FROM Order o JOIN o.products p </li></ul></ul><ul><ul><li>WHERE o.customer.address.zip = ‘94301’ </li></ul></ul>04/05/10
  36. 37. Criteria API <ul><li>Object-based API for building queries </li></ul><ul><li>Designed to mirror JPQL semantics </li></ul><ul><li>Strongly typed </li></ul><ul><ul><li>Based on type-safe metamodel of persistent classes and relationships </li></ul></ul><ul><ul><li>Heavy use of Java generics </li></ul></ul><ul><ul><li>Supports object-based or string-based navigation </li></ul></ul><ul><li>Query construction at development time or runtime </li></ul>04/05/10 EntityManager em = …; CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<ResultType> cquery = cb.createQuery(ResultType.class); Root<MyEntity> e = cquery.from(MyEntity.class); Join<MyEntity, RelatedEntity> j = e.join(…); … cquery.select(…) .where(…) .orderBy(…) .groupBy(…); TypedQuery<ResultType> tq = em.createQuery(cquery); List<ResultType> result = tq.getResultList();
  37. 38. Servlet 3.0 04/05/10
  38. 39. Servlet 3.0 <ul><li>Ease of Development </li></ul><ul><ul><li>Through annotation </li></ul></ul><ul><li>Dynamic registration of Servlets and Filters </li></ul><ul><ul><li>During runtime </li></ul></ul><ul><li>Pluggability (of 3rd-party frameworks/libs) </li></ul><ul><ul><li>No more tweaking of web.xml is needed </li></ul></ul><ul><li>Asynchronous Servlet </li></ul><ul><ul><li>Support Comet applications </li></ul></ul><ul><li>Security enhancements </li></ul>04/05/10
  39. 40. Annotations 04/05/10 Web.xml is not needed any more <ul><li>@WebServlet </li></ul><ul><li>@WebFilter </li></ul><ul><li>@WebListener </li></ul><ul><li>@WebInitParam </li></ul>@WebServlet(urlPatterns=&quot;/simpletest&quot;, name=&quot;MyServlet&quot;, asyncSupported=true) public class SimpleServlet extends HttpServlet{ public void doGet(HttpServletRequest req,HttpServletResponse res){ // Code here } }
  40. 41. Dynamic Registration of Servlets/Filters 04/05/10 public class TestServletContextListener implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) { ServletContext servletConext = sce.getServletContext(); // Servlets/Filters can be added during runtime ServletRegistration.Dynamic dynamic = servletContext.addServlet( &quot;DynamicServlet&quot;, &quot;com.mycom.MyServlet&quot;); dynamic.addMapping(&quot;/dynamicServlet&quot;); dynamic.setAsyncSupported(true); ....
  41. 42. Asynchronous Servlet <ul><li>Async. Servlets are to avoid “thread starvation” in cases such as </li></ul><ul><ul><li>Waiting for resources like JDBC connection) </li></ul></ul><ul><ul><li>Waiting for events </li></ul></ul><ul><ul><li>Waiting for responses like web service responses </li></ul></ul><ul><li>Better scalability </li></ul>04/05/10
  42. 43. Pluggability (of 3rd party Frameworks) <ul><li>Possible to use 3rd-party frameworks and libraries without configuring in web.xml </li></ul><ul><li>Each framework defines its own web-fragment.xml </li></ul><ul><ul><li>Declares its specific controller servlet </li></ul></ul><ul><ul><li>Declares listener and filters </li></ul></ul><ul><li>Container then collects them all </li></ul><ul><li>Order of the frameworks/libs can be </li></ul><ul><li>specified in the web.xml </li></ul><ul><li>A self-contained framework is </li></ul><ul><li>provided as a jar file and placed </li></ul><ul><li>under WEB-INF/lib </li></ul><ul><ul><li>web.xml (optional) </li></ul></ul><ul><ul><li>WEB-INF/lib/ someframework1.jar -> </li></ul></ul><ul><ul><ul><li>META-INF/web-fragment.xml </li></ul></ul></ul><ul><ul><li>WEB-INF/lib/ someframework2.jar -> </li></ul></ul><ul><ul><ul><li>META-INF/web-fragment.xml </li></ul></ul></ul>04/05/10 < web-fragment > <servlet> <servlet-name>MyFramework</servlet-name> <servlet-class>com.MyFrameworkServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>MyFramework</servlet-name> <url-pattern>/MyFramework</url-pattern> </servlet-mapping> ... </ web-fragment >
  43. 44. EJB 3.1 04/05/10
  44. 45. EJB 3.1 <ul><li>Packaging in a war file </li></ul><ul><ul><li>EJB components can be </li></ul></ul><ul><ul><li>packaged directly inside </li></ul></ul><ul><ul><li>a web application archive </li></ul></ul><ul><ul><li>(war file) </li></ul></ul><ul><li>Optional Local Interfaces </li></ul><ul><ul><li>One source file enough </li></ul></ul><ul><ul><li>for a bean </li></ul></ul>04/05/10 @Stateless public class HelloWorldBean { // No interface public String sayHello() { return &quot;Hello World!&quot;; } }
  45. 46. EJB 3.1 contd… <ul><li>Singleton </li></ul><ul><ul><li>A single instance per application </li></ul></ul><ul><li>Asynchronous calls </li></ul>04/05/10 @Singleton public class MyCacheBean { private Map cache; public Map getCache() { … .. } public class MySampleBean { @Asynchronous public Future<Long> sendEmail(String id){ ... }
  46. 47. EJB 3.1 contd… <ul><li>Cron-based Timer Service </li></ul><ul><ul><li>Cron-like syntax </li></ul></ul><ul><ul><ul><li>second [0..59], minute[0..59], hour[0..23]... </li></ul></ul></ul><ul><ul><ul><li>dayOfMonth[1..31] </li></ul></ul></ul><ul><ul><ul><li>dayOfWeek[0..7] or [Sun, Mon..] </li></ul></ul></ul><ul><ul><ul><li>Etc. </li></ul></ul></ul><ul><li>Embeddable Container </li></ul><ul><ul><li>API allows to </li></ul></ul><ul><ul><ul><li>Initialize a container </li></ul></ul></ul><ul><ul><ul><li>Get container ctx </li></ul></ul></ul>04/05/10 @Stateless public class WakeUpBean { @Schedule(dayOfWeek=&quot;Mon-Fri&quot;, hour=&quot;9&quot;) void wakeUp() { ... }
  47. 48. EJB Lite <ul><li>Meets the needs of applications that require only a subset of the features provided by EJB technology. </li></ul><ul><li>Features included </li></ul><ul><ul><li>Stateless, stateful, and singleton session beans </li></ul></ul><ul><ul><li>Local EJB interfaces or no interfaces </li></ul></ul><ul><ul><li>Interceptors </li></ul></ul><ul><ul><li>Container-managed and bean-managed transactions </li></ul></ul><ul><ul><li>Declarative and programmatic security </li></ul></ul><ul><ul><li>Embeddable API </li></ul></ul>04/05/10
  48. 49. Thank You 04/05/10 Visit www.luqmanshareef.com

×