Más contenido relacionado
La actualidad más candente (20)
Similar a Java EE 7 - Embracing the Cloud and HTML 5 (20)
Java EE 7 - Embracing the Cloud and HTML 5
- 1. Java EE 7 –
Embracing the Cloud and HTML 5
-AmitNaik
JavaOne 2012
- 2. About Me
Principal Engineer with the R&D Incubation & Innovation Lab at BMC
Software, Pune.
Work on emerging technologies such as Cloud Computing and
Monitoring, Big Data Analysis, Mobile Architectures, UI frameworks
Systems management & Monitoring background
Experience architecting and building performant and scalable
enterprise solutions across a variety of domains
Working (& playing) with Java from 1997
© Copyright 5/4/2012 BMC Software, Inc 2
- 3. Agenda
Current “buzz”
Java EE 7 – Overview
HTML 5 Features
Cloud Features
Wrap-up and Q&A
© Copyright 5/4/2012 BMC Software, Inc 3
- 4. Current Buzz – Developer Edition
Simplification of Tool set (& Polyglotism)
BIG Data
HTML 5
Cloud
© Copyright 5/4/2012 BMC Software, Inc 4
- 5. Simplification & Polyglotism
Developers demand less boiler plate code
The best tool that fits the task – Polyglotism!
© Copyright 5/4/2012 BMC Software, Inc 5
- 6. JVM is a durable and popular platform
The JVM itself has become a key part of many language strategies!
“invokedynamic” introduced in Java SE 7 as a JVM level feature to better support dynamic
languages
Project Coin – Simplify and add some better syntactic constructs
Multi-catch
try-with-resources
Strings in Switch
Etc…
© Copyright 5/4/2012 BMC Software, Inc 6
- 7. The Challenge of Big Data
Webscale Data
Terrabytes/day
Tweets
Geo Check-ins
Web logs
Social Data
Atmospheric data
Etc, Etc
© Copyright 5/4/2012 BMC Software, Inc 7
- 8. Java to the Rescue (with help from Web 2.0 frameworks)
Java has become the popular
language of choice for
implementation for many big
data frameworks
Apache Hadoop has become a very popular
Java based implementation of the Map-
Reduce Paradigm
Multiple distributions of Hadoop (Cloudera,
DataMeer, HortonWorks)
Cassandra – Highly Available DB engine
written in Java (Facebook)
Column oriented “NoSQL” DB
© Copyright 5/4/2012 BMC Software, Inc 8
- 9. Java EE 7 – Cloud & HTML 5
Java EE 7 and further releases to address:
- HTML 5
- Cloud
© Copyright 5/4/2012 BMC Software, Inc 9
- 11. Java EE 7 - Overview
Java SE 7 (Dolphin) released June-July 2011 -
Java EE 7 to follow
JSR 342: Umbrella JSR for Java EE 7
Q3 2012 Public Review
Q4 2012 Proposed Final Draft
Q1 2013 Final Release (Pushed back from Q3
2012)
© Copyright 5/4/2012 BMC Software, Inc 11
- 12. Java EE 7 Overview - JSRs
© Copyright 5/4/2012 BMC Software, Inc 12
- 13. Four Key aspects
Java EE 7 has a lot of JSRs!
Already covered topics:
- JSR 343: What's Coming in Java Message
Service 2.0
- Java API for JSON
- JAX-RS 2.0: What's in JSR 339?
- Enterprise JavaBeans Technology 3.2
- Java Persistence API 2.1
© Copyright 5/4/2012 BMC Software, Inc 13
- 14. Focus of the presentation
We will look at four key areas:
- JSF enhancements HTML 5 – JSF 2.0 & 2.2
- HTML 5 WebSockets – (JSR 356)
- Concurrency Utils. for EE (JSR 236)
- Cloud – Multiple JSRs
© Copyright 5/4/2012 BMC Software, Inc 14
- 15. JEE 7 and HTML 5
JSF
© Copyright 5/4/2012 BMC Software, Inc 15
- 16. HTML 5 – Future of Web Markup
© Copyright 5/4/2012 BMC Software, Inc 16
- 17. HTML 5 Features: HTML Elements
HTML4 HTML5
Semantic elements for Structure
<header>, <nav>, <article>, <section>, <aside>, <footer>, etc
Cleaner Source – no more “div craziness”
© Copyright 5/4/2012 BMC Software, Inc 17
- 18. HTML 5 Elements: Audio & Video
Audio Today
- Most audio played through flash plug-in
- Not all browsers have same plug-ins (& security risks)
<audio> element:
- Standard way to include audio: sound files or audio stream
- 3 supported formats: Ogg Vorbis, MP3, Wav (browsers may support subset)
Usage example:
<audio controls="controls">
<source src="song.ogg" type="audio/ogg">
<source src="song.mp3" type="audio/mpeg">
</audio>
Specify multiple audio file formats: browser will use first recognized format
“controls” attribute: adds “play”, “pause”, and “volume” controls
© Copyright 5/4/2012 BMC Software, Inc 18
- 19. Java EE 7 - Web Tier support
HTML5 support
Web socket support
Standard JSON API
NIO.2-based web container
© Copyright 5/4/2012 BMC Software, Inc 19
- 20. JSF Composite Components
Truly Reusable component
Turns page markup into a JSF UI component with attached validators,
converters, listeners
<html xmlns=http://www/w3/org/1999/xhtml
xmlns:h=http://java.sun.com/jsf/html
xmlns:f=http://java.sun.com/jsf/core
xmlns:my=”http://java.sun.com/jsf/composite/comp”>
…………….
<my:out value=”yes”/>
On disk:
<context root>/resources/comp/out.xhtml>
JSF Composite components can leverage the HTML 5 JavaScript API!
© Copyright 5/4/2012 BMC Software, Inc 20
- 21. JSF support – HTML 5 with composite components
<html... xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h=http://java.sun.com/jsf/html
xmlns:f="http://java.sun.com/jsf/core" xmlns:cc="http://java.sun.com/jsf/composite">
<h:head> ... </h:head> …
<h:body>
<cc:interface>
<cc:attribute name=”src” required=”true” ”/>
<cc:attribute name=”controls” required=”false” />
</cc:interface>
<cc:implementation>
<h:outputScript library=”js” name=”audio.js” target=”head”/>
<audio src="#{cc.attrs.src}" controls="#{cc.attrs.controls}"></audio>
<input type=”button” value=”Play” onclick=”play()”/>
<input type=”button” value=”Pause” onclick=”pause()”/>
</cc:implementation>
</h:body>
© Copyright 5/4/2012 BMC Software, Inc 21
- 22. JSF support – HTML 5 with composite components
audio.js:
function play() {
var audio = document.getElementsByTagName("audio")[0];
audio.play();
var display =
document.getElementsByTagName("input")[0];
display.value = audio.src; }
function pause() {
var audio = document.getElementsByTagName("audio")[0];
audio.pause(); }
© Copyright 5/4/2012 BMC Software, Inc 22
- 23. JSF Support for HTML 5 to be enhanced
JSF 2.2 enhancements for HTML5 support
- Semantic tags, browser feature detection
- Use of HTML5 by components
- Audio and Video usage enhancements
JSR-276 (tool support)
Mobile renderkits
Page resolver and application context manager
API
© Copyright 5/4/2012 BMC Software, Inc 23
- 24. JEE 7 and HTML 5
WebSockets
© Copyright 5/4/2012 BMC Software, Inc 24
- 25. WebSocket – Bidirectional TCP
Way for multiplexing bi-directional, full-duplex communications channels
over a single TCP connection
Real-time, bidirectional web communication with low overhead (compared
to technologies such as COMET)
Standardized way for the server to send content to the browser without
being solicited by the client
TCP port 80 – no need for additional firewall port rules
TCP based, uses HTTP 'handshake' to initiate & terminate WebSocket session
Defines two new URI schemes -
ws: and wss: for unencrypted and encrypted connections
Supported Chrome 16, Firefox 11 and Internet Explorer 10
Blessed by IETF – Tracked by RFC 6455
© Copyright 5/4/2012 BMC Software, Inc 25
- 26. WebSocket – HTTP connection Handshake
Client Request:
GET /mychat HTTP/1.1
Host: server.example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==
Sec-WebSocket-Protocol: chat
Sec-WebSocket-Version: 13
Server response:
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade Sec-WebSocket-Accept:
HSmrc0sMlYUkAGmm5OPpG2HaGWk=
Sec-WebSocket-Protocol: chat
© Copyright 5/4/2012 BMC Software, Inc 26
- 27. Java API for WebSocket support JSR – JSR 356
Creating components to handle bi-directional WebSocket
conversations
Initiating and intercepting WebSocket events
Creation and consumption of WebSocket text and binary messages
Abililty to define WebSocket protocols & content models
Configuration and management of WebSocket sessions,
- timeouts,
- retries,
- connection pooling
Define how WebSocket applications within Java EE security model
© Copyright 5/4/2012 BMC Software, Inc 27
- 28. Web Socket Sample (w/Grizzly WebSocket API)
public class ChatApplication extends WebSocketApplication<ChatWebSocket>
{
protected ChatWebSocket createWebSocket(Connection c,
ServerWebSocketMeta m)
{ return new ChatWebSocket(c, m, this); }
public void onMessage(ChatWebSocket s, DataFrame frame) {
String msg = frame.getAsText();
s.sendJson(s.getUser(), msg);
}
public void onClose(ChatWebSocket s)
{ s.sendJson(“system”, s.getUser() + “ left the chat”); }
}
© Copyright 5/4/2012 BMC Software, Inc 28
- 30. Concurrency Utils – not for managed code!
Java.util.concurrent is a great set of libraries for
managing concurrent executions – makes writing
multi-threaded code (somewhat) simple
Cannot (should not) be used in managed
environments!
Server containers provide runtime support for Java EE
application components (Servlets and EJBs)
Layer between the App code and Platform resources
Multi-threaded code is discouraged in “Managed”
© Copyright 5/4/2012 BMC Software, Inc 30
- 31. Managed Code unfriendly APIs
java.util.Timer
java.lang.Thread
java.util.concurrent.ExecutorService
ThreadPoolExecutor
….
© Copyright 5/4/2012 BMC Software, Inc 31
- 32. javax.enterprise.concurrent for Managed code
JSR 236: Concurrency Utilities for Java EE
Created in 2003 Inactive till now
Getting a Reboot now!
Q4 2012: Release Public Review Draft
Q1 2013: Final Release
On-Track for Java EE 7
© Copyright 5/4/2012 BMC Software, Inc 32
- 33. Preview of javax.enterprise.concurrent (JSR 236)
ManagedExecutorService - Manageable version of a ExecutorService.
ManagedScheduledExecutorService - Manageable version of a
ScheduledExecutorService.
ManagedTaskListener - ManagedTaskListener is used to monitor the
state of a task's Future.
ManagedThreadFactory - Manageable version of a ThreadFactory
Etc…
© Copyright 5/4/2012 BMC Software, Inc 33
- 34. JEE 7 and Cloud
© Copyright 5/4/2012 BMC Software, Inc 34
- 36. Cloud Introduction
Service Delivery Models
- IaaS – Infrastructure as a Service – Amazon EC2, Rackspace
- PaaS – Platform as a Service – CloudFoundry, Heroku,
Force.com, Google Apps, Amazon Beanstalk
- SaaS – Software as a Service – SalesForce, Workday
Ownership/Deployment Flavors
- Public
- Private
- Hybrid
- Community
© Copyright 5/4/2012 BMC Software, Inc 36
- 37. Service Delivery Models
IaaS
Platform as a Service (PaaS)
- Deploy customer created/acquired apps
- Using languages and tools supported by PaaS
Provider
- No control of underlying cloud infrastructure
- Control over deployed applications, hosting
env. Configuration for owned apps
© Copyright 5/4/2012 BMC Software, Inc 37
- 38. Cloud Offerings are vendor specific
Taxonomies, APIs, Service Levels, Interconnections, etc are varied
In the IaaS space: AWS is emerging as a de-facto standard (API adopted by
Eucalyptus, CloudStack etc)
In the PaaS space: Number
of providers springing up
that can provide support for
Java Applications and
services
© Copyright 5/4/2012 BMC Software, Inc 38
- 40. Needs of a PaaS Ready app
Application as a whole need to be versioned
Multiple versions can coexist
Must deal with data versioning, upgrades, etc.
Need ability to specify QoS properties
Apps both expose and connect to services simultaneously
Tighter requirements for resource and state
management
Better isolation between applications
© Copyright 5/4/2012 BMC Software, Inc 40
- 42. Java EE 7 Cloud Focus: Platform as a Service
Next logical step for Java EE
Java EE 7 : Evolves from Providing Services to Being one
Define new platform roles to accommodate PaaS model
Services become First Class citizens
Add metadata
- For service provisioning and configuration
- For QoS, Elasticity
- For sharing of applications and resources
- For (re)configurability and customization
Add useful APIs for cloud environment
- JAX-RS client API, Caching API, State Management, JSON,…
Extend existing APIs with support for multi-tenancy
© Copyright 5/4/2012 BMC Software, Inc 42
- 43. New PaaS Roles in Java EE 7
PaaS Product Vendor
PaaS Provider
PaaS Account Manager
PaaS Customer
Application Submitter
Application Administrator
End-User
© Copyright 5/4/2012 BMC Software, Inc 43
- 44. Multi-tenancy in Java EE 7
Support for separate isolated instances of the same
app for different tenants
- One application instance per tenant
- Tenants correspond to units of isolation
- Multitenant apps are declared as such
- Each instance customized and deployed for a
single tenant
Mapping to tenant done by the container
Tenant id available to application
- E.g., under java:comp/tenantId or by injection
© Copyright 5/4/2012 BMC Software, Inc 44
- 45. Multi-Tenancy Illustration
Goal: Simple configuration
Flexible tenant discriminator support
Other areas impacted - JNDI, JMS, EJB …
© Copyright 5/4/2012 BMC Software, Inc 45
- 46. PaaS Impact on deployment – Traditional Deployment
© Copyright 5/4/2012 BMC Software, Inc 46
- 47. PaaS Impact on deployment – Cloud Deployment
© Copyright 5/4/2012 BMC Software, Inc 47
- 48. Wrap-up
Java EE 7 is going to be a major step forward
HTML 5 support being added incrementally thru
number of JSRs
Embracing the Cloud and focusing on PaaS space
JVM continues to be a very popular part of
Java Ecosystem
Exciting times ahead!
- Modularity (Project Jigsaw), Closures, etc
© Copyright 5/4/2012 BMC Software, Inc 48
- 51. References
http://www.infoq.com/articles/twitter-java-use
http://cloudopsmanagement.wordpress.com/2011/06/02/open-
source-engine-powering-the-next-gen-cloud-stack-part-1/
http://en.wikipedia.org/wiki/HTML5
http://www.slideshare.net/keilw/java-ee-7-the-voyage-of-the-
cloud-treader
http://en.wikipedia.org/wiki/WebSocket
http://www.rfc-editor.org/rfc/rfc6455.txt
http://xkcd.com/927/
© Copyright 5/4/2012 BMC Software, Inc 51
- 52. Learn more at www.bmc.com
© Copyright 5/4/2012 BMC Software, Inc 52