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
110
0
Share
Concurrent SSJS on the JVM
Presentation from the Fronteers Jam Session 2012 in Amsterdam.
Philipp Naderer
February 19, 2014
More Decks by Philipp Naderer
See All by Philipp Naderer
Im Maschinenraum der Corona-Dashboards
botic
0
77
The Making of a Coronavirus Dashboard
botic
0
150
Seestadt.bot @ Demo Night: Chatbots & Voice Apps
botic
0
130
Seestadt come2gether – StadtKatalog
botic
0
75
Location-aware Documents
botic
0
120
Chatbots @ HacksHackers Munich
botic
0
99
Chatbots @ Mediencamp Vienna
botic
0
180
GEN Editors Lab Munich – BotOx / Team ORF
botic
0
300
Final Master Thesis Presentation
botic
0
190
Other Decks in Programming
See All in Programming
AI駆動開発勉強会 広島支部 第一回勉強会 AI駆動開発概要とワークショップ
hayatoshimiu
0
430
Stage 3 Decorators でできること / できないこと / TSKaigi 2026
susisu
1
1.5k
RTSPクライアントを自作してみた話
simotin13
0
420
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
430
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
180
These Five Tricks Can Make Your Apps Greener, Cheaper, & Nicer
hollycummins
0
260
dRuby over BLE
makicamel
2
280
初めてのRubyKaigiはこう見えた
jellyfish700
0
400
3Dシーンの圧縮
fadis
1
580
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
11k
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
3.3k
Migrations : C'est une question d'hygiène !
vinceamstoutz
0
2.9k
Featured
See All Featured
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
320
Practical Orchestrator
shlominoach
191
11k
Making the Leap to Tech Lead
cromwellryan
135
9.9k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
390
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
150
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
240
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
Agile that works and the tools we love
rasmusluckow
331
21k
The agentic SEO stack - context over prompts
schlessera
0
790
Information Architects: The Missing Link in Design Systems
soysaucechin
0
950
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