Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Of concurrency and other demons
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Rodrigo Graciano
January 16, 2021
Technology
180
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Of concurrency and other demons
Talk about concurrency.
Initially presented at DawsCon with Hillmer Chona
Rodrigo Graciano
January 16, 2021
More Decks by Rodrigo Graciano
See All by Rodrigo Graciano
Advancing with Java
graciano
0
55
Your Java isn't the same
graciano
0
250
Cloud Batch
graciano
0
210
Batch Processing
graciano
0
460
Java 9 ao 17 - Oracle no TDC
graciano
0
160
KnoxJava - Java 9-17
graciano
0
190
Java 9 to Java 16: A review of recent changes to the language
graciano
0
200
Java 9 ao 15 - Evolução da Linguagem Java
graciano
0
300
Other Decks in Technology
See All in Technology
[re:Invent2026事前勉強会(有志開催)]続きは、ラスベガスの廊下で / continue-in-the-vegas-hallway
sh_fk2
0
490
SLOを阻む不安
sraku2159
0
210
Agent Loopを組み込んだ アンビエントなAI機能を実現する / Ambient AI fetures with Agent Loop
nekorush14
0
130
詳解 never 型 - ボトム型の性質を深掘り
nealle
0
140
AIに任せられるFlutterコードベースを作る 〜仕様をコードで表し、ハーネスで守る〜
myohei
1
630
Oracle Database Security 詳細解説
oracle4engineer
PRO
1
220
リアクションエンジニア ― 小さなリアクションから、話しかけやすい組織をつくる ―
ryuguyana
1
110
キヨさん、67歳。AIコーディングエージェントに挑む
happysamurai294
0
140
今から始めるAWS環境の暗号移行 - ポスト量子時代に備える
sato4mi
0
150
AX時代の自治体支援リソース再配分と役割分担の再構成:戦略とロードマップ(概要)
sishi2026
0
180
これだけは抑えておきたい!後悔しない re:Invent の過ごし方 / AWS re:Invent 2026 prestudy
kinunori
2
670
Vue で書く 空間コンピューティング、TresJS と WebXR を使ったXR デバイスのフロントエンド開発
hiranuma
0
150
Featured
See All Featured
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
600
How to Ace a Technical Interview
jacobian
280
24k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
540
The Pragmatic Product Professional
lauravandoore
37
7.5k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
410
We Have a Design System, Now What?
morganepeng
55
8.4k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
650
Faster Mobile Websites
deanohume
310
32k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
600
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
23k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
960
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()
• • • •