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
170
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
41
Your Java isn't the same
graciano
0
240
Cloud Batch
graciano
0
200
Batch Processing
graciano
0
440
Java 9 ao 17 - Oracle no TDC
graciano
0
150
KnoxJava - Java 9-17
graciano
0
180
Java 9 to Java 16: A review of recent changes to the language
graciano
0
180
Java 9 ao 15 - Evolução da Linguagem Java
graciano
0
300
Other Decks in Technology
See All in Technology
アプリをもっと"iOSアプリっぽく"する小さな工夫 / Small Touches That Make Your App Feel More Like an iOS App
matsuji
2
950
あけおめLINE 傾向とその対策
nasa9084
0
130
生成AIエージェントを用いた、 手動テスト手順書から自動テストへの 変換手法の検討
magicpod
0
170
AIエージェントの権限管理 3: Agentic RAG の Fine grained access control 編
ren8k
0
110
白金鉱業Meetup Vol.25 アウトカムが二値のデータに対するCausal Impact
brainpadpr
0
240
今話題のAI「Jev」って何? 宇宙最速で学ぶ会
minorun365
PRO
27
16k
積み重なった技術負債への挑戦 〜初手としての全社ゴト化〜
techtekt
PRO
0
1.3k
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
5
25k
データ界隈LT祭 第1回LT登壇
taromatsui_cccmkhd
2
1.4k
AIエージェントの一手は 誰も見ていない - Falco拡張OSS「Prempti」とeBPFで サーバーレス実行基盤を二層防御する
keitah
0
190
AIに任せた品質は、誰が見立てるのか - AI時代のテストマネジメント
nakanao
3
2.1k
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
360
Featured
See All Featured
How to make the Groovebox
asonas
2
2.4k
The Invisible Side of Design
smashingmag
301
52k
From π to Pie charts
rasagy
1
370
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Ethics towards AI in product and experience design
skipperchong
2
380
Documentation Writing (for coders)
carmenintech
77
5.5k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
830
Scaling GitHub
holman
464
140k
Facilitating Awesome Meetings
lara
57
7.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
530
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()
• • • •