SlideShare uma empresa Scribd logo
1 de 35
Baixar para ler offline
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Project 
Avatar 
Server-­‐side 
JavaScript 
on 
the 
JVM 
! 
JAX 
London 
-­‐ 
Oct. 
2014 
David 
Delabassee 
(@delabassee) 
Oracle
Safe 
Harbor 
Statement 
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 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
2
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Agenda 
Setting 
the 
Context 
Avatar 
– 
Enterprise 
Node 
on 
the 
JVM 
Demo 
1 
3 
3 
2
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Agenda 
Setting 
the 
Context 
Avatar 
– 
Enterprise 
Node 
on 
the 
JVM 
Demo 
1 
2 
3 
4
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Node.js 
• Server-­‐side 
JavaScript 
based 
on 
Chrome 
v8 
engine 
• Created 
in 
2009, 
Open 
Source 
• Designed 
for 
scalable 
Internet 
applications 
• Melting 
pot 
community 
– Java, 
.NET, 
Browser, 
PHP, 
etc, 
experience 
• Node 
Packaged 
Modules 
– Very 
active, 
with 
+98,000 
modules 
(YMMV) 
5 
Server 
Side 
JavaScript
Node.js 
Programming 
Model 
• Multi-­‐threading 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
is 
hard 
– Thousands 
of 
concurrent 
connections 
– Deal 
with 
deadlocks 
and 
race 
conditions 
• Blocking 
on 
I/O 
is 
bad 
• Event 
Loop 
– Reactive 
Model 
– Non-­‐blocking 
I/O 
calls 
• Application 
code 
executes 
in 
a 
single 
thread 
6 
Event 
Clients Loop 
Non-­‐blocking 
Worker
Node.js 
Programming 
Model 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
7 
var http = require("http");! 
! 
http.createServer( … ).listen(80);
Node.js 
Programming 
Model 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
8 
var http = require("http");! 
! 
http.createServer(function(request, response) {! 
! response.writeHead(200, {"Content-type": "text/plain"});! 
! response.write("Hello World";)! 
! response.end();! 
}).listen(80);
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Nashorn 
! 
• Bundled 
with 
Java 
7 
and 
8 
• ECMAScript 
5.1 
compatibility 
• Performance 
(vs 
Rhino) 
• Java 
Interoperability 
9 
6 
4,5 
3 
1,5 
0 
crypto earley-­‐boyer mandreel pdas regexp splay 
rhino 
nashorn 
jdk8 
nashorn 
jdk9 
JavaScript 
Engine
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Nashorn 
Quick 
Demo 
10
Scaling 
Server-­‐Side 
JavaScript 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
11
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
What 
If 
I’m 
in 
a 
Java 
Shop? 
• Java 
Developer 
Investments 
– In-­‐house 
Java-­‐based 
frameworks 
– 3rd 
party 
commercial 
and/or 
open 
source 
libraries 
– Lots 
of 
experience 
with 
Java 
development 
• Investment 
in 
Java 
infrastructure 
– Java 
EE 
application 
servers 
– JMX-­‐based 
monitoring 
and 
management 
– Established 
data 
center 
processes 
and 
best 
practices 
– “We 
are 
a 
Java 
company”, 
or 
“We 
already 
do 
Java 
and 
.NET” 
12
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Project 
Avatar 
13 
Bridging 
the 
gap 
Avatar 
Node 
on 
the 
JVM 
! 
Thousands 
of 
Node 
libraries 
! 
Thousands 
of 
Java 
libraries 
Java 
EE 
Interoperability 
! 
Leverage 
Existing 
Infrastructure 
! 
Build 
Enterprise 
Applications 
in 
JavaScript 
!
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Agenda 
Setting 
the 
context 
Avatar 
– 
Enterprise 
Node 
on 
the 
JVM 
Demo 
1 
2 
3 
14
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Avatar 
2.0 
• 95% 
Node 
compatibility 
provided 
by 
Avatar.js 
• Uses 
same 
C 
portability 
libraries 
as 
Node.js 
– libuv, 
http-­‐parser 
• No 
Chrome 
v8 
native 
APIs! 
• Run 
popular 
packages 
– Express, 
async, 
commander, 
etc. 
15
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Avatar 
2.0 
• Enterprise 
Features 
– Advanced 
multithreading 
– State 
sharing 
– Avatar 
Persistence 
– Java 
EE 
Interoperability 
(EJB, 
JMS) 
16
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Avatar 
2.0 
-­‐ 
What’s 
new 
• Runs 
standalone 
– Out 
of 
the 
box, 
no 
application 
server 
required 
• Run 
from 
command 
line 
• Use 
your 
favorite 
Node 
framework(s) 
• Use 
your 
favorite 
client 
framework 
17
Avatar 
Process 
Application JavaScript Modules & Java Jars 
Bundled Third-Party JavaScript Modules 
Avatar API Modules 
WLS T3 thin client 
EclipseLink, NoSQL 
MBeans 
Avatar 
Flight Recorder Probes 
Application 
JavaScript 
& 
Java 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
18 
Avatar 
2.0 
Architecture 
REST/WS/SSE 
JVM 
Core Node Modules 
Nashorn & JRE 8 
Mission 
Control 
Mgmt Plugin Admin Agent 
EJB/JMS WebLogic 
Data Database 
libuv + JNI bindings 
JavaScript 
code 
Java 
code 
Platform 
specific 
native 
code 
Optional 
Processes 
Coherence State Coherence
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Nashorn 
! 
• Bundled 
with 
Java 
7 
and 
8 
• ECMAScript 
5.1 
compatibility 
• Performance 
(vs 
Rhino) 
• Java 
Interoperability 
19 
6 
4,5 
3 
1,5 
0 
crypto earley-­‐boyer mandreel pdas regexp splay 
rhino 
nashorn 
jdk8 
nashorn 
jdk9 
JavaScript 
Engine
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
20 
Nashorn 
-­‐ 
Using 
Java 
8 
within 
a 
Node 
app 
var http = require("http");! 
var list = new java.util.ArrayList();! 
! 
list.add("Blue"); list.add(“Green"); list.add("Yellow");! 
list.add("Red"); list.add("Dark Red"); list.add("Light Red”);! 
! 
http.createServer(function(request, response) {! 
response.writeHead(200, {"Content-Type": "application/json"});! ! 
var count = list.parallelStream()! 
.filter(function(t) { return t.match('Red') } )! 
.count();! ! 
response.end(“{'reds': count}”);! 
}).listen(8080);
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Avatar 
Multithreading 
• Multiple 
instances 
of 
an 
application 
in 
single 
JVM 
process 
– Each 
instance 
has 
its 
own 
event 
loop 
thread 
and 
JavaScript 
context 
– Shared 
sockets 
– 
every 
instance 
listens 
on 
the 
same 
port 
– Optional 
coordination 
via 
JavaScript 
state 
sharing 
APIs 
– Messaging 
API 
– Map 
API 
• Can 
dynamically 
create 
background 
threads 
as 
well 
21 
Taking 
advantage 
of 
the 
multithreaded 
JVM
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Avatar 
Application 
Scaling 
22 
A 
picture 
is 
worth 
a 
thousand 
threads
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
23 
Creating 
New 
Event 
Threads 
!var threads = require('avatar/threads');! 
var createBallThread = function(ballInfo) {! 
! var deferred = when.defer();! 
! var eventThread = threads.newEventThread("BouncingBallThread", ! 
! ! __dirname + "/ball.js", [! 
! ! ! "color=" + ballInfo.color,! 
! ! ! "gravity=" + ballInfo.gravity,! 
! ! ! "rowid=" + ballInfo.id_! 
!! ! ]);! 
! eventThread.start(function (event, error) {! 
! ! switch(event) {! 
! ! ! case "started":! 
! ! ! ! console.log("Thread ", eventThread.thread.index(), "Started");! 
! ! ! ! ballInfo.id = eventThread.thread.index();! 
…
Avatar 
Shared 
State 
Framework 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
• Message 
Bus 
– Publish 
/ 
subscribe 
message 
passing 
• Shared 
State 
– Simple 
map 
API 
– Application-­‐scoped 
instance 
– Session-­‐scoped 
instance 
• Named 
• Leased, 
with 
configurable 
timeout 
• Avatar 
provides 
required 
serialization, 
concurrency 
control, 
and 
caching 
24 
Lightweight 
inter-­‐thread 
communication
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
25 
Message 
Bus 
(Subscribe) 
bus.on("kill", function (id) {! 
if (_interval && _id && (_id.toString() === id.toString())) {! 
clearInterval(_interval);! 
process.exit();! 
}! 
});! 
! 
bus.subscribe("argsUpdate", function (data) {! 
if (data.id === app.threadIndex) {! 
gravity = data.gravity;! 
}! 
});
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
26 
Message 
Bus 
(Publish) 
_interval = setInterval(function () {! 
var msg = {! 
id: _id, ! 
color: app.args.color,! 
heartbeat: heartbeat++, ! 
…! 
};! ! 
msg.message = "Thread " + app.threadIndex + " | Heartbeat: " +! 
heartbeat + " | Gravity: " + gravity;! ! 
bus.publish("messages", msg);! ! 
}, 2000);
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
• Supports 
Relational 
& 
NoSQL 
databases 
• Similar 
to 
Sequelize, 
JugglingDB, 
etc 
• Leverages 
EclipseLink 
JPA 
Provider 
• Leverages 
mature, 
feature 
rich 
Java 
ecosystem 
– Tooling 
to 
generate 
JavaScript 
model 
for 
existing 
database 
schema 
– 2nd 
level 
JPA 
cache 
(TopLink 
Grid) 
– Oracle 
RAC 
connection 
pooling, 
etc. 
27 
Avatar 
Persistence 
Framework 
JavaScript 
API
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
28 
Avatar 
Persistence 
(Model) 
var avatar = require("avatar");! 
var model = require("avatar/model");! ! 
var store = model.newStore(config.db.name, {! 
database: config.db.database,! 
username: config.db.username,! 
properties: { "eclipselink.logging.level": “INFO” }! 
});! ! 
var BallModel = model.newModel("Ball", {! 
"color": "string",! 
"gravity": "number"! 
});! ! 
store.bind(BallModel);
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
29 
Avatar 
Persistence 
(Model) 
var avatar = require("avatar");! 
var model = require("avatar/model");! ! 
var store = model.newStore(config.db.name, {! 
database: config.db.database,! 
username: config.db.username,! 
properties: { "eclipselink.logging.level": “INFO” }! 
});! ! 
var BallModel = model.newModel("Ball", {! 
"color": "string",! 
"gravity": "number"! 
});! ! 
store.bind(BallModel);
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
30 
Avatar 
Persistence 
return {! 
! getThreads: function() {! 
! ! return BallModel.getAll();! 
! },! 
! ! 
! createThread: function(thread) {! 
! ! return BallModel.create(aBall);! 
! },! 
! ! 
! deleteThread: function(id) {! 
! ! return BallModel.delete(id);! 
! },! 
! ! 
! updateThread: function(data) {! 
! ! var deferred = when.defer();! 
! ! BallModel.get(data.id_).then(function(row) {! 
! ! row.gravity = parseInt(data.gravity);! 
! ! BallModel.put(row).then(function(updatedRow) {
Additional 
Features 
and 
Potential 
• Expand 
Java 
Mission 
Control 
/ 
Flight 
Recorder 
support 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
• Remote 
EJB 
and 
JMS 
support 
– Using 
WebLogic 
t3 
thin 
client 
• Automatically 
reload 
application 
on 
file 
change 
(development 
feature) 
• Work 
in 
progress 
– Coherence 
(JCache) 
integration 
for 
cross-­‐JVM 
state 
sharing 
– Manage 
using 
WebLogic 
and/or 
Oracle 
Enterprise 
Manager 
31
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Agenda 
Setting 
the 
context 
Avatar 
– 
Enterprise 
Node 
on 
the 
JVM 
Demo 
1 
2 
3 
32
model.js 
heartbeat gravity heartbeat heartbeat Message 
Bus 
express.js ws.js avatar.js 
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
33 
Browser main.js ball.js ball.js ball.js 
. 
. 
. 
ball.js 
newEventThread(‘ball.js’) 
REST 
WebSocket 
Avatar 
Process 
Database 
Demo
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
Next 
• Check 
Avatar 
- http://avatar.java.net 
• We 
plan 
to 
open 
source 
Avatar 
2.0 
soon 
• We 
need 
your 
feedback! 
! 
• Thank 
You! 
34
Copyright 
© 
2014, 
Oracle 
and/or 
its 
affiliates. 
All 
rights 
reserved. 
| 
35

Mais conteúdo relacionado

Mais procurados

Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
David Delabassee
 

Mais procurados (18)

Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling Rewriter
 
Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the Horizon
 
Nashorn in the future (English)
Nashorn in the future (English)Nashorn in the future (English)
Nashorn in the future (English)
 
Java: Create The Future Keynote
Java: Create The Future KeynoteJava: Create The Future Keynote
Java: Create The Future Keynote
 
JavaScript Interview Questions and Answers | Full Stack Web Development Train...
JavaScript Interview Questions and Answers | Full Stack Web Development Train...JavaScript Interview Questions and Answers | Full Stack Web Development Train...
JavaScript Interview Questions and Answers | Full Stack Web Development Train...
 
40020
4002040020
40020
 
Real life-maf-2015
Real life-maf-2015Real life-maf-2015
Real life-maf-2015
 
Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!
 
01 java intro
01 java intro01 java intro
01 java intro
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
 
Java EE 8 Update
Java EE 8 UpdateJava EE 8 Update
Java EE 8 Update
 
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
 
Real Life MAF (2.2) Oracle Open World 2015
Real Life MAF (2.2) Oracle Open World 2015Real Life MAF (2.2) Oracle Open World 2015
Real Life MAF (2.2) Oracle Open World 2015
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applications
 
JavaOne 2014 BOF4241 What's Next for JSF?
JavaOne 2014 BOF4241 What's Next for JSF?JavaOne 2014 BOF4241 What's Next for JSF?
JavaOne 2014 BOF4241 What's Next for JSF?
 
Avoiding Java EE Application Design Traps to Achieve Effective Use of Cloud C...
Avoiding Java EE Application Design Traps to Achieve Effective Use of Cloud C...Avoiding Java EE Application Design Traps to Achieve Effective Use of Cloud C...
Avoiding Java EE Application Design Traps to Achieve Effective Use of Cloud C...
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6
 

Semelhante a Server Side JavaScript on the Java Platform - David Delabassee

Project Avatar (Lyon JUG & Alpes JUG - March 2014)
Project Avatar (Lyon JUG & Alpes JUG  - March 2014)Project Avatar (Lyon JUG & Alpes JUG  - March 2014)
Project Avatar (Lyon JUG & Alpes JUG - March 2014)
David Delabassee
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with Scala
WO Community
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 
Java EE 7 (Lyon JUG & Alpes JUG - March 2014)
Java EE 7 (Lyon JUG & Alpes JUG  - March 2014)Java EE 7 (Lyon JUG & Alpes JUG  - March 2014)
Java EE 7 (Lyon JUG & Alpes JUG - March 2014)
David Delabassee
 
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2
 

Semelhante a Server Side JavaScript on the Java Platform - David Delabassee (20)

Project Avatar (Lyon JUG & Alpes JUG - March 2014)
Project Avatar (Lyon JUG & Alpes JUG  - March 2014)Project Avatar (Lyon JUG & Alpes JUG  - March 2014)
Project Avatar (Lyon JUG & Alpes JUG - March 2014)
 
What's new in Java 8
What's new in Java 8What's new in Java 8
What's new in Java 8
 
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
 
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
 
WebSockets in Enterprise Applications
WebSockets in Enterprise ApplicationsWebSockets in Enterprise Applications
WebSockets in Enterprise Applications
 
Web Application Defences
Web Application DefencesWeb Application Defences
Web Application Defences
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with Scala
 
Porto Tech Hub Conference 2023 - Revolutionize Java DB AppDev with Reactive S...
Porto Tech Hub Conference 2023 - Revolutionize Java DB AppDev with Reactive S...Porto Tech Hub Conference 2023 - Revolutionize Java DB AppDev with Reactive S...
Porto Tech Hub Conference 2023 - Revolutionize Java DB AppDev with Reactive S...
 
Java vs. Java Script for enterprise web applications - Chris Bailey
Java vs. Java Script for enterprise web applications - Chris BaileyJava vs. Java Script for enterprise web applications - Chris Bailey
Java vs. Java Script for enterprise web applications - Chris Bailey
 
JAX London 2015: Java vs Nodejs
JAX London 2015: Java vs NodejsJAX London 2015: Java vs Nodejs
JAX London 2015: Java vs Nodejs
 
BarcelonaJUG - Revolutionize Java Database Application Development with React...
BarcelonaJUG - Revolutionize Java Database Application Development with React...BarcelonaJUG - Revolutionize Java Database Application Development with React...
BarcelonaJUG - Revolutionize Java Database Application Development with React...
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
2015 Java update and roadmap, JUG sevilla
2015  Java update and roadmap, JUG sevilla2015  Java update and roadmap, JUG sevilla
2015 Java update and roadmap, JUG sevilla
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
 
40020
4002040020
40020
 
Java EE 7 (Lyon JUG & Alpes JUG - March 2014)
Java EE 7 (Lyon JUG & Alpes JUG  - March 2014)Java EE 7 (Lyon JUG & Alpes JUG  - March 2014)
Java EE 7 (Lyon JUG & Alpes JUG - March 2014)
 
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
 
WSO2 AppDev platform
WSO2 AppDev platformWSO2 AppDev platform
WSO2 AppDev platform
 

Mais de JAXLondon2014

How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
JAXLondon2014
 
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
JAXLondon2014
 
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
JAXLondon2014
 

Mais de JAXLondon2014 (20)

GridGain 6.0: Open Source In-Memory Computing Platform - Nikita Ivanov
GridGain 6.0: Open Source In-Memory Computing Platform - Nikita IvanovGridGain 6.0: Open Source In-Memory Computing Platform - Nikita Ivanov
GridGain 6.0: Open Source In-Memory Computing Platform - Nikita Ivanov
 
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
Performance Metrics for your Delivery Pipeline - Wolfgang GottesheimPerformance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
 
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
 
Conditional Logging Considered Harmful - Sean Reilly
Conditional Logging Considered Harmful - Sean ReillyConditional Logging Considered Harmful - Sean Reilly
Conditional Logging Considered Harmful - Sean Reilly
 
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim RemaniFinding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
 
API Management - a hands on workshop - Paul Fremantle
API Management - a hands on workshop - Paul FremantleAPI Management - a hands on workshop - Paul Fremantle
API Management - a hands on workshop - Paul Fremantle
 
'Bootiful' Code with Spring Boot - Josh Long
'Bootiful' Code with Spring Boot - Josh Long'Bootiful' Code with Spring Boot - Josh Long
'Bootiful' Code with Spring Boot - Josh Long
 
The Full Stack Java Developer - Josh Long
The Full Stack Java Developer - Josh LongThe Full Stack Java Developer - Josh Long
The Full Stack Java Developer - Josh Long
 
The Economies of Scaling Software - Josh Long and Abdelmonaim Remani
The Economies of Scaling Software - Josh Long and Abdelmonaim RemaniThe Economies of Scaling Software - Josh Long and Abdelmonaim Remani
The Economies of Scaling Software - Josh Long and Abdelmonaim Remani
 
Dataflow, the Forgotten Way - Russel Winder
Dataflow, the Forgotten Way - Russel WinderDataflow, the Forgotten Way - Russel Winder
Dataflow, the Forgotten Way - Russel Winder
 
Habits of Highly Effective Technical Teams - Martijn Verburg
Habits of Highly Effective Technical Teams - Martijn VerburgHabits of Highly Effective Technical Teams - Martijn Verburg
Habits of Highly Effective Technical Teams - Martijn Verburg
 
The Lazy Developer's Guide to Cloud Foundry - Holly Cummins
The Lazy Developer's Guide to Cloud Foundry - Holly CumminsThe Lazy Developer's Guide to Cloud Foundry - Holly Cummins
The Lazy Developer's Guide to Cloud Foundry - Holly Cummins
 
Testing within an Agile Environment - Beyza Sakir and Chris Gollop
Testing within an Agile Environment - Beyza Sakir and Chris GollopTesting within an Agile Environment - Beyza Sakir and Chris Gollop
Testing within an Agile Environment - Beyza Sakir and Chris Gollop
 
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
 
Squeezing Performance of out of In-Memory Data Grids - Fuad Malikov
Squeezing Performance of out of In-Memory Data Grids - Fuad MalikovSqueezing Performance of out of In-Memory Data Grids - Fuad Malikov
Squeezing Performance of out of In-Memory Data Grids - Fuad Malikov
 
Spocktacular Testing - Russel Winder
Spocktacular Testing - Russel WinderSpocktacular Testing - Russel Winder
Spocktacular Testing - Russel Winder
 
Reflection Madness - Dr. Heinz Kabutz
Reflection Madness - Dr. Heinz KabutzReflection Madness - Dr. Heinz Kabutz
Reflection Madness - Dr. Heinz Kabutz
 
Rapid Web Application Development with MongoDB and the JVM - Trisha Gee
Rapid Web Application Development with MongoDB and the JVM - Trisha GeeRapid Web Application Development with MongoDB and the JVM - Trisha Gee
Rapid Web Application Development with MongoDB and the JVM - Trisha Gee
 
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
 
Personal Retrospectives - Johannes Thönes
Personal Retrospectives - Johannes ThönesPersonal Retrospectives - Johannes Thönes
Personal Retrospectives - Johannes Thönes
 

Último

Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
amilabibi1
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
Kayode Fayemi
 
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven CuriosityUnlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Hung Le
 
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
David Celestin
 
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
ZurliaSoop
 

Último (17)

ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdfSOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
 
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven CuriosityUnlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio III
 
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
in kuwait௹+918133066128....) @abortion pills for sale in Kuwait City
in kuwait௹+918133066128....) @abortion pills for sale in Kuwait Cityin kuwait௹+918133066128....) @abortion pills for sale in Kuwait City
in kuwait௹+918133066128....) @abortion pills for sale in Kuwait City
 
Zone Chairperson Role and Responsibilities New updated.pptx
Zone Chairperson Role and Responsibilities New updated.pptxZone Chairperson Role and Responsibilities New updated.pptx
Zone Chairperson Role and Responsibilities New updated.pptx
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
Introduction to Artificial intelligence.
Introduction to Artificial intelligence.Introduction to Artificial intelligence.
Introduction to Artificial intelligence.
 
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
 
Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of Drupal
 

Server Side JavaScript on the Java Platform - David Delabassee

  • 1. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Project Avatar Server-­‐side JavaScript on the JVM ! JAX London -­‐ Oct. 2014 David Delabassee (@delabassee) Oracle
  • 2. Safe Harbor Statement 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 © 2014, Oracle and/or its affiliates. All rights reserved. 2
  • 3. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Agenda Setting the Context Avatar – Enterprise Node on the JVM Demo 1 3 3 2
  • 4. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Agenda Setting the Context Avatar – Enterprise Node on the JVM Demo 1 2 3 4
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Node.js • Server-­‐side JavaScript based on Chrome v8 engine • Created in 2009, Open Source • Designed for scalable Internet applications • Melting pot community – Java, .NET, Browser, PHP, etc, experience • Node Packaged Modules – Very active, with +98,000 modules (YMMV) 5 Server Side JavaScript
  • 6. Node.js Programming Model • Multi-­‐threading Copyright © 2014, Oracle and/or its affiliates. All rights reserved. is hard – Thousands of concurrent connections – Deal with deadlocks and race conditions • Blocking on I/O is bad • Event Loop – Reactive Model – Non-­‐blocking I/O calls • Application code executes in a single thread 6 Event Clients Loop Non-­‐blocking Worker
  • 7. Node.js Programming Model Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 7 var http = require("http");! ! http.createServer( … ).listen(80);
  • 8. Node.js Programming Model Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 8 var http = require("http");! ! http.createServer(function(request, response) {! ! response.writeHead(200, {"Content-type": "text/plain"});! ! response.write("Hello World";)! ! response.end();! }).listen(80);
  • 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Nashorn ! • Bundled with Java 7 and 8 • ECMAScript 5.1 compatibility • Performance (vs Rhino) • Java Interoperability 9 6 4,5 3 1,5 0 crypto earley-­‐boyer mandreel pdas regexp splay rhino nashorn jdk8 nashorn jdk9 JavaScript Engine
  • 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Nashorn Quick Demo 10
  • 11. Scaling Server-­‐Side JavaScript Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 11
  • 12. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. What If I’m in a Java Shop? • Java Developer Investments – In-­‐house Java-­‐based frameworks – 3rd party commercial and/or open source libraries – Lots of experience with Java development • Investment in Java infrastructure – Java EE application servers – JMX-­‐based monitoring and management – Established data center processes and best practices – “We are a Java company”, or “We already do Java and .NET” 12
  • 13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Project Avatar 13 Bridging the gap Avatar Node on the JVM ! Thousands of Node libraries ! Thousands of Java libraries Java EE Interoperability ! Leverage Existing Infrastructure ! Build Enterprise Applications in JavaScript !
  • 14. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Agenda Setting the context Avatar – Enterprise Node on the JVM Demo 1 2 3 14
  • 15. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Avatar 2.0 • 95% Node compatibility provided by Avatar.js • Uses same C portability libraries as Node.js – libuv, http-­‐parser • No Chrome v8 native APIs! • Run popular packages – Express, async, commander, etc. 15
  • 16. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Avatar 2.0 • Enterprise Features – Advanced multithreading – State sharing – Avatar Persistence – Java EE Interoperability (EJB, JMS) 16
  • 17. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Avatar 2.0 -­‐ What’s new • Runs standalone – Out of the box, no application server required • Run from command line • Use your favorite Node framework(s) • Use your favorite client framework 17
  • 18. Avatar Process Application JavaScript Modules & Java Jars Bundled Third-Party JavaScript Modules Avatar API Modules WLS T3 thin client EclipseLink, NoSQL MBeans Avatar Flight Recorder Probes Application JavaScript & Java Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 18 Avatar 2.0 Architecture REST/WS/SSE JVM Core Node Modules Nashorn & JRE 8 Mission Control Mgmt Plugin Admin Agent EJB/JMS WebLogic Data Database libuv + JNI bindings JavaScript code Java code Platform specific native code Optional Processes Coherence State Coherence
  • 19. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Nashorn ! • Bundled with Java 7 and 8 • ECMAScript 5.1 compatibility • Performance (vs Rhino) • Java Interoperability 19 6 4,5 3 1,5 0 crypto earley-­‐boyer mandreel pdas regexp splay rhino nashorn jdk8 nashorn jdk9 JavaScript Engine
  • 20. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 20 Nashorn -­‐ Using Java 8 within a Node app var http = require("http");! var list = new java.util.ArrayList();! ! list.add("Blue"); list.add(“Green"); list.add("Yellow");! list.add("Red"); list.add("Dark Red"); list.add("Light Red”);! ! http.createServer(function(request, response) {! response.writeHead(200, {"Content-Type": "application/json"});! ! var count = list.parallelStream()! .filter(function(t) { return t.match('Red') } )! .count();! ! response.end(“{'reds': count}”);! }).listen(8080);
  • 21. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Avatar Multithreading • Multiple instances of an application in single JVM process – Each instance has its own event loop thread and JavaScript context – Shared sockets – every instance listens on the same port – Optional coordination via JavaScript state sharing APIs – Messaging API – Map API • Can dynamically create background threads as well 21 Taking advantage of the multithreaded JVM
  • 22. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Avatar Application Scaling 22 A picture is worth a thousand threads
  • 23. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 23 Creating New Event Threads !var threads = require('avatar/threads');! var createBallThread = function(ballInfo) {! ! var deferred = when.defer();! ! var eventThread = threads.newEventThread("BouncingBallThread", ! ! ! __dirname + "/ball.js", [! ! ! ! "color=" + ballInfo.color,! ! ! ! "gravity=" + ballInfo.gravity,! ! ! ! "rowid=" + ballInfo.id_! !! ! ]);! ! eventThread.start(function (event, error) {! ! ! switch(event) {! ! ! ! case "started":! ! ! ! ! console.log("Thread ", eventThread.thread.index(), "Started");! ! ! ! ! ballInfo.id = eventThread.thread.index();! …
  • 24. Avatar Shared State Framework Copyright © 2014, Oracle and/or its affiliates. All rights reserved. • Message Bus – Publish / subscribe message passing • Shared State – Simple map API – Application-­‐scoped instance – Session-­‐scoped instance • Named • Leased, with configurable timeout • Avatar provides required serialization, concurrency control, and caching 24 Lightweight inter-­‐thread communication
  • 25. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 25 Message Bus (Subscribe) bus.on("kill", function (id) {! if (_interval && _id && (_id.toString() === id.toString())) {! clearInterval(_interval);! process.exit();! }! });! ! bus.subscribe("argsUpdate", function (data) {! if (data.id === app.threadIndex) {! gravity = data.gravity;! }! });
  • 26. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 26 Message Bus (Publish) _interval = setInterval(function () {! var msg = {! id: _id, ! color: app.args.color,! heartbeat: heartbeat++, ! …! };! ! msg.message = "Thread " + app.threadIndex + " | Heartbeat: " +! heartbeat + " | Gravity: " + gravity;! ! bus.publish("messages", msg);! ! }, 2000);
  • 27. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. • Supports Relational & NoSQL databases • Similar to Sequelize, JugglingDB, etc • Leverages EclipseLink JPA Provider • Leverages mature, feature rich Java ecosystem – Tooling to generate JavaScript model for existing database schema – 2nd level JPA cache (TopLink Grid) – Oracle RAC connection pooling, etc. 27 Avatar Persistence Framework JavaScript API
  • 28. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 28 Avatar Persistence (Model) var avatar = require("avatar");! var model = require("avatar/model");! ! var store = model.newStore(config.db.name, {! database: config.db.database,! username: config.db.username,! properties: { "eclipselink.logging.level": “INFO” }! });! ! var BallModel = model.newModel("Ball", {! "color": "string",! "gravity": "number"! });! ! store.bind(BallModel);
  • 29. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 29 Avatar Persistence (Model) var avatar = require("avatar");! var model = require("avatar/model");! ! var store = model.newStore(config.db.name, {! database: config.db.database,! username: config.db.username,! properties: { "eclipselink.logging.level": “INFO” }! });! ! var BallModel = model.newModel("Ball", {! "color": "string",! "gravity": "number"! });! ! store.bind(BallModel);
  • 30. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 30 Avatar Persistence return {! ! getThreads: function() {! ! ! return BallModel.getAll();! ! },! ! ! ! createThread: function(thread) {! ! ! return BallModel.create(aBall);! ! },! ! ! ! deleteThread: function(id) {! ! ! return BallModel.delete(id);! ! },! ! ! ! updateThread: function(data) {! ! ! var deferred = when.defer();! ! ! BallModel.get(data.id_).then(function(row) {! ! ! row.gravity = parseInt(data.gravity);! ! ! BallModel.put(row).then(function(updatedRow) {
  • 31. Additional Features and Potential • Expand Java Mission Control / Flight Recorder support Copyright © 2014, Oracle and/or its affiliates. All rights reserved. • Remote EJB and JMS support – Using WebLogic t3 thin client • Automatically reload application on file change (development feature) • Work in progress – Coherence (JCache) integration for cross-­‐JVM state sharing – Manage using WebLogic and/or Oracle Enterprise Manager 31
  • 32. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Agenda Setting the context Avatar – Enterprise Node on the JVM Demo 1 2 3 32
  • 33. model.js heartbeat gravity heartbeat heartbeat Message Bus express.js ws.js avatar.js Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 33 Browser main.js ball.js ball.js ball.js . . . ball.js newEventThread(‘ball.js’) REST WebSocket Avatar Process Database Demo
  • 34. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Next • Check Avatar - http://avatar.java.net • We plan to open source Avatar 2.0 soon • We need your feedback! ! • Thank You! 34
  • 35. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 35