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
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
48
Your Java isn't the same
graciano
0
240
Cloud Batch
graciano
0
210
Batch Processing
graciano
0
460
Java 9 ao 17 - Oracle no TDC
graciano
0
150
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
事業活動を AI Ready にする攻めと守りのデータエンジニアリング / data-engineering-for-ai-ready-business
pei0804
7
2.6k
Jetson Orin Nanoとk3sとローカルLLMで音声文字起こしシステム作ってみた
y_sera15
0
120
今さら理解するウェブフォントver.2026
takanorip
3
680
FactoryBotアンチパターン / factory_bot anti-patterns
toshimaru
0
150
生成AIと進める探索的データ分析(2026.10.03 第122回Tokyo.R勉強会)
tatamiya
2
1.5k
QA4AI 2026-Oct 生成AI時代の品質保証
tokuty
0
350
継続的なAIコスト最適化
bgpat
1
290
Claude Code本は、どのように執筆チームで書かれたか
oikon48
1
360
Classmethod Company Deck
satoshi7
0
130
DGX Spark でどこまでハッキングができるのか?
kash1064
0
870
全人類(ほぼ)AWS Organizations の上でAWSを利用している、その世界を知る話
htan
1
140
組み立てて楽しむ AWS Blocks 入門
kmiya84377
0
230
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
1
570
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
30 Presentation Tips
portentint
PRO
1
430
How to Talk to Developers About Accessibility
jct
2
570
sira's awesome portfolio website redesign presentation
elsirapls
0
450
Building a Scalable Design System with Sketch
lauravandoore
464
34k
BBQ
matthewcrist
90
10k
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
Into the Great Unknown - MozCon
thekraken
41
2.8k
YesSQL, Process and Tooling at Scale
rocio
174
15k
How to make the Groovebox
asonas
2
2.5k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
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()
• • • •