Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Concurrent SSJS on the JVM
Search
Philipp Naderer
February 19, 2014
Programming
0
110
Concurrent SSJS on the JVM
Presentation from the Fronteers Jam Session 2012 in Amsterdam.
Philipp Naderer
February 19, 2014
Tweet
Share
More Decks by Philipp Naderer
See All by Philipp Naderer
Im Maschinenraum der Corona-Dashboards
botic
0
68
The Making of a Coronavirus Dashboard
botic
0
140
Seestadt.bot @ Demo Night: Chatbots & Voice Apps
botic
0
130
Seestadt come2gether – StadtKatalog
botic
0
73
Location-aware Documents
botic
0
110
Chatbots @ HacksHackers Munich
botic
0
88
Chatbots @ Mediencamp Vienna
botic
0
170
GEN Editors Lab Munich – BotOx / Team ORF
botic
0
280
Final Master Thesis Presentation
botic
0
180
Other Decks in Programming
See All in Programming
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.8k
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
7
1k
Fluid Templating in TYPO3 14
s2b
0
120
Apache Iceberg V3 and migration to V3
tomtanaka
0
120
Vibe codingでおすすめの言語と開発手法
uyuki234
0
210
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.2k
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
530
CSC307 Lecture 04
javiergs
PRO
0
650
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
220
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
430
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.7k
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.7k
Featured
See All Featured
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
420
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.3k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
400
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.5k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
150
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
920
Tell your own story through comics
letsgokoyo
1
800
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
240
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
67
Transcript
Concurrent SSJS on the JVM Philipp Naderer / @botic
None
None
RingoJS • JavaScript on the JVM • Based on Mozilla
Rhino • Part of Java SE 6 and Java SE 7 • Successor / Rewrite of Helma • 14 years of SSJS experience!
Features • CommonJS modules & packages • Full access to
Java libraries • ECMAScript 5 and JS 1.8 support • Lots of „ringo/“ modules • dates, http, concurrency, logging, subprocesses, jsgi, command line, ...
Debugger
Threads and SSJS? • Ringo‘s concept: Workers • Implicit multithreaded
code • You can use an EventLoop • No shared global object* • Singletons instead of shared data
myWebApp Module myWebApp Module blocking running running Event Loop
webserver.js var response = require("ringo/jsgi/response"); var {Application} = require("stick"); !
var app = exports.app = new Application(); ! // Configure stick middlewares app.configure("notfound", "route"); ! app.get("/", function(request) { return response.html("<h1>Servas Amsterdam!</h1>"); }); ! if (require.main == module) { require("ringo/httpserver").main(module.id); }
webserver.js serving 10.000 HTTP requests
„Ringo Workers“ • Look like Web Workers in Browsers •
No JSON serialization needed = faster! • Send a message with postMessage(e) • React on message with onMessage(e) • Return the result to the caller with postMessage(e)
fibobuster.js 1. var {Worker} = require("ringo/worker"); 2. 3. // Create
50 Workers = 50 Threads 4. for (var i = 50; i < 100; i++) { 5. var w = new Worker(module.resolve("./fibonacci")); 6. 7. // Callback for the output 8. w.onmessage = function(returnObj) { 9. console.log("Result: " + returnObj.data.result); 10. } 11. 12. // Start with the calculation 13. w.postMessage(i); 14. }
fibonacci.js function onmessage(message) { var limit = message.data; ! console.log("Fibonacci
#" + limit); ! /* Calculate the fibonacci number */ var a = ..., b = ..., c = ...; for (...) { ... } ! message.source.postMessage({ result: c }); }
RingoJS infos • ringojs.org – basic information • github.com/ringojs –
source + examples • @ringojs – official account • @hannesw – Hannes‘ account • IRC: irc.freenode.net #ringojs
None