Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
1
GlassFish BOF
Reza Rahman, GlassFish Evangelist
Anil Gaur, VP Software Development
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
2
The following 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.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
3
Agenda
Journey since JavaOne 2012
Road Ahead
Community Feedback
Your agenda…Q&A
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
4
GlassFish Community
Shipped Java EE 7 RI
More social: More Twitter followers
Community contributions
–
FishCat
–
Mohammed, Marcus, Adam & many more
–
Adopt
-
a
-
JSR effort with 20+ JUGs
–
Tic Tac Toe Sample
-
Johan
Since JavaOne 2012…
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
5
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
6
Java EE 7
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
7
Java EE Past, Present, & Future
J2EE 1.3
CMP,
Connector
Architecture
J2EE
1.4
Web
Services
Mgmt,
Deployment,
Async
Connector
Java EE 5
Ease of
Development,
EJB 3, JPA,
JSF, JAXB,
JAX
-
WS,
StAX, SAAJ
Java EE 6
Pruning,
Extensibility,
Ease of Use,
CDI, JAX
-
RS
Web Profile
Servlet 3,
EJB 3.1
Lite
Java EE 7
JMS 2,
Batch, TX,
Concurrency,
Interceptor,
WebSocket,
JSON
Web Profile
JAX
-
RS 2
JAX
-
RPC
,
CMP/ BMP
,
JSR 88
J2EE 1.2
Servlet, JSP,
EJB, JMS,
RMI
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
8
Java EE 7
Connector
1.6
Managed Beans 1.0
EJB 3.2
Servlet 3.1
Portable
Extension
s
JSF 2.2
JAX
-
RS
2.0
Bean Validation 1.1
JMS 2.0
JPA 2.1
EL 3.0
JTA 1.2
JSP 2.2
Interceptors 1.1
CDI 1.1
Common
Annotations 1.1
Updated
Major
Release
New
Concurrency Utilities
(JSR 236)
Batch Applications
(JSR 352)
Java API for JSON
(JSR 353)
Java API for WebSocket
(JSR 356)
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
9
Java API for WebSocket
Full
-
duplex, bidirectional communication over HTTP
–
Part of HTML 5
API for WebSocket Client/Server
–
Declarative, annotation
-
driven
–
Programmatic, interface
-
driven
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
10
Java API for WebSocket
Connection Life Cycle
@Singleton
@ServerEndpoint(”/chat”)
public class ChatServer {
Set<Session> peers = ...
@OnOpen
public void onOpen(Session peer) {
peers.add(session);
}
@OnClose
public void onClose(Session session) {
peers.remove(session);
}
...
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
11
Java API for WebSocket
WebSocket Communication
...
@OnMessage
public void message(String message, Session client)
throws IOException {
for (Session session : peers) {
if (!session.equals(client)) {
session.getBasicRemote().sendObject(message);
}
}
}
}
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
12
JAX
-
RS 2
Client API
Message filters & entity interceptors
Asynchronous processing
–
Server and client
Hypermedia Support
Mime type negotiation
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
13
JAX
-
RS 2
Client API
// Get instance of Client
Client client =
ClientBuilder.newClient()
;
// Get customer name for the shipped products
String name = client.target(“
../orders/{orderId}/customer
”)
.pathParam(”orderId", ”10”)
.queryParam(”shipped", ”true”)
.request()
.get(String.class);
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
14
JMS 2
API modernization
–
Streamlined APIs
–
Dependency injection
–
Runtime exceptions
–
Builder pattern
–
Intelligent defaults
Delivery delay, async send, delivery count
MDB alignment
JMS resource definition
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
15
JMS 2
Old API
@Resource(lookup = "java:global/jms/demoConnectionFactory")
ConnectionFactory connectionFactory;
@Resource(lookup = "java:global/jms/demoQueue")
Queue demoQueue;
public void sendMessage(String payload) {
try {
Connection connection = connectionFactory.createConnection();
try {
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer =
session.createProducer(demoQueue);
TextMessage textMessage = session.createTextMessage(payload);
messageProducer.send(textMessage);
} finally {
connection.close();
}
} catch (JMSException ex) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
}
}
Boilerplate
Functional core
Checked exceptions
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
16
JMS 2
Simplified API
@Inject
private JMSContext context;
@Resource(mappedName = "jms/inboundQueue")
private Queue inboundQueue;
public void sendMessage (String payload) {
context.createProducer().send(inboundQueue, payload);
}
Reduced to functional core
Higher
-
level managed, injected API
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
17
Batch Applications for the Java Platform
Standard Java API for batch processing
Lingua franca for well understood batch concepts
–
Jobs, job specification language (JSL), steps, readers, writers,
processors, chunking, flow, parallelization, repositories
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
18
<step id=”
sendStatements
”
>
<chunk reader ref=”
accountReader
”
processor ref=”
accountProcessor
”
writer ref=
”
emailWriter
”
chunk
-
size=”10” />
</step>
Batch Applications for the Java Platform
Step Example
...implements ItemReader {
public Object readItem() {
// read account using JPA
}
...implements ItemProcessor {
Public Object processItems(Object account) {
// read Account, return Statement
}
...implements ItemWriter {
public void writeItems(List accounts) {
// use JavaMail to send email
}
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
19
Concurrency Utilities for Java EE
Provides low
-
level asynchronous processing capabilities to Java EE
application components in a safe, reliable, consistent manner
Mostly extension of Java SE Concurrency Utilities APIs
–
Managed
ExecutorService
–
Managed
ScheduledExecutorService
–
Managed
ThreadFactory
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
20
Concurrency Utilities for Java EE
Managed Task Executor
public class TestServlet extends HTTPServlet {
@Resource(name=“concurrent/MyExecutorService”)
ManagedExecutorService executor;
Future future = executor.submit(new MyTask());
class MyTask implements Runnable {
public void run() {
...
// Task logic
}
}
}
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
21
Many others . . .
•
JSON
-
P:
Parsing, writing and querying JSON
•
JSF 2.2:
@FlowScoped, HTML5 forms, CDI alignment…
•
Bean Validation 1.1:
Method validation, CDI alignment…
•
Servlet 3.1:
Non
-
blocking IO, Upgrade to WebSocket…
•
EL 3.0:
Lambda expressions, Collection, Operators…
•
JPA 2.1
: Schema generation, stored procedures, converters…
•
JTA 1.2
: @Transactional, @TransactionScoped…
•
CDI 1.1
: Ordering of interceptors, Servlet events, @Vetoed…
•
EJB 3.2:
Optional CMP/BMP…
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
22
GlassFish 4
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
23
GlassFish 4
Primary focus on making Java EE 7 usable by developers
Java EE 7 support in the Admin Console
–
Java EE Concurrency, JBatch
Background execution of admin commands
More REST/SSE support for administration
Log format changes
Configuration defaults
OSGi administration
Feature Summary
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
24
GlassFish 4 and Java EE 7 Concurrency
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
25
GlassFish 4 and JBatch
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
26
GlassFish 4 and JBatch
list
-
batch
-
job
-
executions
list
-
batch
-
job
-
steps
list
-
batch
-
jobs
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
27
Attach/Detach Admin Commands
Commands can be executed in the background
–
Use
--
detach
with any command to send to the background
–
Use
--
terse in scripts to receive just job id
Show all running jobs using
list
-
jobs
Bring a job back to the foreground using the
attach
command
Use the configure
-
managed
-
jobs command to further control the
lifecycle of jobs
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
28
More Support for REST/SSE
A more REST centric approach with /command/{command_name}
–
GET for command syntax, POST to execute
–
JSON for data interchange
curl
-
X POST
-
H "X
-
Requested
-
By: reza"
http://localhost:4848/command/uptime
Supports Server Sent Events (SSE)
–
Try the [start|stop]
-
cluster command
curl
-
X POST
-
H "X
-
Requested
-
By: reza"
-
H "Accept: text/event
-
stream"
-
d "clusterName=c01"
http://localhost:4848/command/stop
-
cluster
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
29
ODL vs. ULF
Default log format changed to align with Oracle products
Oracle Diagnostics Logging
–
[
yyyy
-
mm
-
dd
T
hh
:
mm
:
ss
.
SSS
-
Z
][
ProductName
-
Version
][
Log Level
]
[
Message ID
][
LoggerName
][
Key Value Pairs
][[
Message
]]
Uniform Log Formatter
–
[#|
yyyy
-
mm
-
dd
T
hh
:
mm
:
ss
.
SSS
-
Z
|
Log Level
|
ProductName
-
Version
|
LoggerName
|
Key Value Pairs
|
Message
|#]
–
Well understood from GlassFish 3.1
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
30
More Logging Commands
Large set of existing logging related commands
–
Define threshold, file rotation, file names, …
New commands
–
list
-
loggers
helps in understanding logger hierarchy
–
set
-
log
-
file
-
format
to choose ODL, ULF or custom
Still possible to use log viewer in the Admin Console
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
31
Configuration Defaults
GlassFish 3.1
–
configuration values must be specified
GlassFish 4
–
introduce default values where possible
–
Convergence to zero initial configuration
get
-
active
-
module
-
config
prints effective values
create
-
module
-
config
forces default values into the configuration
–
Use as a template for configuration changes
–
--
dryrun
just prints what’s being added
delete
-
module
-
config
removes actual configuration
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
32
OSGi Administration
GlassFish modularity is based on OSGi
–
Default OSGi subsystem is Apache Felix
Integrated GoGo interface
–
The
osgi
command executes one GoGo command
–
The
osgi
-
shell
command opens interactive GoGo console
Optional OSGi admin console
–
Add on to GlassFish
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
33
More Details/Demos
CON3319: GlassFish 4 Overview: What’s Under the Hood?
–
Chanda Patel/Martin Mares
–
Wednesday, September 25, 11:30 AM
-
12:30 PM
–
Parc 55
-
Cyril Magnin I
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
34
GlassFish Server
The Ecosystem
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
35
GlassFish.org
–
New Look and Feel!
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
36
Project Avatar
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
37
What is Avatar?
Industry trends
–
HTML5 and JavaScript is a significant trendsetter in market
–
HTML5 Connectivity
–
need a server
–
Strong interest in server
-
side JavaScript; horizontally scale
–
Native Applications gaining ground (but expensive)
–
Simplified user interface for browser
-
based applications for mobile, tablets and desktops
Avatar Scope
–
Java EE features to support HTML5 connectivity
WebSocket, JAX
-
RS, Server Sent Events
–
JavaScript services on the server
–
Enable Thin Server Architecture
Web Application Framework
R&D on HTML5/JavaScript
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
38
Project Avatar Architecture
1.
Publishing services using
3 programming models:
1.
WebSockets
2.
RESTful WebServices
3.
Server
-
Sent Events (SSE)
2.
Node.js services &
programming model
hosted on the JVM
(avatar.js on Nashorn)
3.
Optional server
-
side
template support for
HTML5 data binding
4.
Optional client library to
consume all the above
HTML
5
Client
*.html
*.js
*.
css
HTTP
(REST)
Web
Sockets
SSE
Application
Server
Java EE
JAX
-
RS
JMS
EJB
Data Sources
JPA
Avatar
Server
JAXB
JSONB
Scripting
Container
WebSockets
SSE
Data
Access
Change
Notification
Databases
Node.jar
Nashorn
4
1
3
2
Servlets
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
39
Avatar Demo
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
40
Project Avatar
Participate and provide feedback
–
Join avatar.java.net
–
Download and Review sample applications
–
Use Project Avatar
–
Ask questions
–
What is the direction we should take?
GlassFish Open Source Project
Java EE .next
Call to Action
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
41
Roadmap
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
42
GlassFish Server Roadmap
GlassFish Server 4.0
GlassFish Server 4.1
2012
2013
2014
GlassFish Server 3.1.2.2
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
43
The Future of Java EE
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
44
Summary
Java EE 7 themes are HTML5, productivity and enterprise needs
Well received by the community
GlassFish 4 reference implementation and first application server
implementing Java EE 7
Oracle continues to invest in Java EE/GlassFish
Get involved in shaping the future!
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
45
Try it Out!
4.0
http://glassfish.org
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
46
Enter the password to open this PDF file:
File name:
-
File size:
-
Title:
-
Author:
-
Subject:
-
Keywords:
-
Creation Date:
-
Modification Date:
-
Creator:
-
PDF Producer:
-
PDF Version:
-
Page Count:
-
Preparing document for printing…
0%
Comments 0
Log in to post a comment