Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Of concurrency and other demons
Search
Rodrigo Graciano
January 16, 2021
Technology
0
140
Of concurrency and other demons
Talk about concurrency.
Initially presented at DawsCon with Hillmer Chona
Rodrigo Graciano
January 16, 2021
Tweet
Share
More Decks by Rodrigo Graciano
See All by Rodrigo Graciano
Beyond Coding
graciano
0
26
Your Java isn't the same
graciano
0
210
Cloud Batch
graciano
0
170
Batch Processing
graciano
0
390
Java 9 ao 17 - Oracle no TDC
graciano
0
120
KnoxJava - Java 9-17
graciano
0
170
Java 9 to Java 16: A review of recent changes to the language
graciano
0
150
Java 9 ao 15 - Evolução da Linguagem Java
graciano
0
280
Other Decks in Technology
See All in Technology
Identity Management for Agentic AI 解説
fujie
0
350
Fashion×AI「似合う」を届けるためのWEARのAI戦略
zozotech
PRO
2
1.1k
【U/Day Tokyo 2025】Cygames流 最新スマートフォンゲームの技術設計 〜『Shadowverse: Worlds Beyond』におけるアーキテクチャ再設計の挑戦~
cygames
PRO
2
1.1k
なぜ あなたはそんなに re:Invent に行くのか?
miu_crescent
PRO
0
120
20251203_AIxIoTビジネス共創ラボ_第4回勉強会_BP山崎.pdf
iotcomjpadmin
0
110
AWS re:Invent 2025~初参加の成果と学び~
kubomasataka
0
170
_第4回__AIxIoTビジネス共創ラボ紹介資料_20251203.pdf
iotcomjpadmin
0
110
IAMユーザーゼロの運用は果たして可能なのか
yama3133
2
520
事業の財務責任に向き合うリクルートデータプラットフォームのFinOps
recruitengineers
PRO
2
170
AI時代の新規LLMプロダクト開発: Findy Insightsを3ヶ月で立ち上げた舞台裏と振り返り
dakuon
0
400
高度サイバー人材育成専科資料(前半)
nomizone
0
450
202512_AIoT.pdf
iotcomjpadmin
0
110
Featured
See All Featured
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
190
Chasing Engaging Ingredients in Design
codingconduct
0
78
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
0
70
A better future with KSS
kneath
240
18k
New Earth Scene 8
popppiees
0
1.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.2k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
390
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
130
Abbi's Birthday
coloredviolet
0
3.6k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
What does AI have to do with Human Rights?
axbom
PRO
0
1.9k
Transcript
None
➔ Software developer - Team lead ➔ Java Champion ➔
Medellin Java Users Group Leader ➔ hibernate/hibernate-validator Contributor ➔ Duke’s Choice Award Winner ➔ Eclipse Collections contributor
➔ Professional with 10+ years ➔ Principal Software Engineer -
NY ➔ NYJavaSIG Leader ➔ graciano.dev ➔ Twitter: @rodrigograciano
• • • •
• Concurrency when we have many task, largely independent, and
we use the same resource to do them at a time • Parallelism is when we want to do one task, and we split up in multiple subtasks
A Thread is an independent path of execution that allows
a program to operate more efficiently by doing multiple things at the same time. Threads can be used to perform complicated tasks in the background without interrupting the main program.
• Synchronous: when we wait to finish a task before
moving to the next one • Asynchronous: when we move to another task before it finishes
• Thread t = new Thread( ()-> this.doSomething( thing ));
t.start(); • ExecutorService executor = Executors.newFixedThreadPool( 10 ); Future<?> future = executor.submit( ()-> this.doSomething( thing )); • CompletableFuture.runAsync( ()-> this.doSomething( thing )); • Thread.builder().virtual().name("name").task(() -> this.doSomething( thing )).start();
None
None
Stream API CompletableFuture Creation Chained operations Return forEach runAsync thenAccept
/ thenRun void map supplyAsync thenApply CompletableFuture<U>
None
CompletableFuture<Void>::runAsync (Runnable runnable) <U> CompletableFuture<U>::supplyAsync (Supplier<U> supplier) CompletableFuture<Void>::runAsync (Runnable runnable,
Executor executor) <U> CompletableFuture<U>::supplyAsync (Supplier<U> supplier, Executor executor)
static ExecutorService newCachedThreadPool() static ExecutorService newFixedThreadPool (int nThreads) static ScheduledExecutorService
newScheduledThreadPool (int corePoolSize) static ExecutorService newSingleThreadExecutor() static ScheduledExecutorService newSingleThreadScheduledExecutor() static ExecutorService newWorkStealingPool()
T::get () throws InterruptedException , ExecutionException T::get (long timeout, TimeUnit
unit) throws InterruptedException , ExecutionException , TimeoutException T::getNow (T valueIfAbsent) T::join()
• • • •