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
Of concurrency and other demons
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Rodrigo Graciano
January 16, 2021
Technology
160
0
Share
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
32
Your Java isn't the same
graciano
0
230
Cloud Batch
graciano
0
190
Batch Processing
graciano
0
420
Java 9 ao 17 - Oracle no TDC
graciano
0
140
KnoxJava - Java 9-17
graciano
0
170
Java 9 to Java 16: A review of recent changes to the language
graciano
0
170
Java 9 ao 15 - Evolução da Linguagem Java
graciano
0
290
Other Decks in Technology
See All in Technology
AI活用の格差をなくす:チーム全体のAI開発生産性を底上げする方法
moongift
PRO
1
110
サプライチェーン攻撃への備えについて考えている #湘なんか
stefafafan
3
2.4k
組織の中で自分を経営する技術
shoota
0
150
イベントで大活躍する電子ペーパー名札 〜その3〜 / ビジュアルプログラミングIoTLT vol.23
you
PRO
0
150
Amazon CloudFrontにおけるAIボットアクセス制御のポイント
kizawa2020
4
280
TypeScriptはどのようにどこまで推論できるのか ─ とにかく as は禁止で
ypresto
3
440
Kaggle未経験社員をメダリストに育てる「AIドラゴン桜」
lycorptech_jp
PRO
0
600
TSKaigi 2026 - 型プラグインシステムの実装に使われるテクニック
teamlab
PRO
2
440
AI時代に改めて考える、ドメイン駆動設計 - モデリングが「AIへの共通言語」になる
littlehands
8
2.5k
責任あるソフトウェアエンジニアリングの紹介4章・5章 / RSE_Ch4-5
ido_kara_deru
0
340
AI時代の私の技術インプットとアウトプット術
tonkotsuboy_com
12
6.7k
Generative UI × A2UI で AI エージェントを作った話 AI-DLC も使ってみた!
kmiya84377
1
230
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
3k
Test your architecture with Archunit
thirion
1
2.2k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
940
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
Building Adaptive Systems
keathley
44
3k
Believing is Seeing
oripsolob
1
130
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.8k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Technical Leadership for Architectural Decision Making
baasie
3
380
Git: the NoSQL Database
bkeepers
PRO
432
67k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
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()
• • • •