Structured Concurrency in Java: The What & Why • Balkrishna Rawool • GOTO 2023
This presentation was recorded at GOTO Amsterdam 2023. #GOTOcon #GOTOams
Balkrishna Rawool - IT Chapter Lead at ING
RESOURCES
ABSTRACT
This talk introduces Virtual Threads and Structured Concurrency and explains their benefits and shortcomings. It compares Structured Concurrency API with CompletableFuture API by live coding multiple examples with both of these APIs.
Virtual threads are lightweight user threads, enabling Java applications to produce thousands (or even millions) of threads. Also, they are super-efficient as they don’t block their ’carrier’ threads. These two characteristics of virtual threads let application developers focus on business requirements rather than managing platform threads (for example, with thread-pools etc.) which enables Structured Concurrency.
With structured concurrency, we can let each business-task be executed by a separate virtual thread and structure these virtual threads in any logical way that we want. It provides us with control structures for managing our virtual threads and simplifies applications that use concurrency.
A big part of the talk is live coding where multiple examples are first implemented with CompletableFuture and then with Structured Concurrency API. For each example, these two implementations are then compared. These examples highlight that CompletableFuture’s reactive-like API relies on callbacks whereas Structured Concurrency puts forward an imperative-like API which is easier to read and reason.
All in all, this talk introduces virtual threads and structured concurrency to the audience and explains why one should seriously consider using it. [...]
TIMECODES
00:00 Intro
00:27 Project Loom
01:55 How to create virtual threads?
03:53 Demo
06:55 Virtual Threads continued
08:28 Demo
09:07 Virtual Threads continued
10:53 Structured Concurrency
14:42 CompletableFuture API vs Structured Concurrency API
15:09 Demo
38:55 Shutdown policies
40:43 Outro
Download slides and read the full abstract here:
RECOMMENDED BOOKS
Jeff Scott Brown & Graeme Rocher • The Definitive Guide to Grails 2 •
Todd Raymond Sharp • Introducing Micronaut •
Sanjay Patni • Pro RESTful APIs with Micronaut •
Nirmal Singh & Zack Dawood • Building Microservices with Micronaut •
#Java #Java21 #Concurrency #StructuredConcurrency #VirtualThreads #API #ProjectLoom #PlatformThreads #CompletableFuture #ING #Pinning #BalkrishnaRawool
Looking for a unique learning experience?
Attend the next GOTO conference near you! Get your ticket at
Sign up for updates and specials at
SUBSCRIBE TO OUR CHANNEL - new videos posted almost daily.
1 view
0
0
5 months ago 00:15:33 1
EB-5 Investor Visa Program - Two ways to obtaining a Green Card by Attorney Ernest Goodman
5 months ago 00:03:42 1
UVReactor - Trailer
5 months ago 00:14:48 1
EB-5 Investor Visa Program - Two ways to obtaining a Green Card
5 months ago 00:11:46 1
All Java 23 Features - Inside Java Newscast #70
6 months ago 00:52:41 1
What is this rare multi-user UNIX workstation? (Plexus P/20)
8 months ago 00:37:38 1
Java Project Loom: Why Should I Care? • Erwin de Gier • GOTO 2023
9 months ago 01:25:33 1
LES BRICS ÉLARGIS PEUVENT-ILS REDÉFINIR L’ORDRE MONDIAL ? | HERLIN, STOQUER, PENGAM [LJGP#9]
9 months ago 00:40:57 1
Rapports de la vérificatrice générale du Canada sur ArivveCAN
9 months ago 00:04:31 4
Structuring the medieval page | Exploring the Medieval Manuscript Book
9 months ago 01:17:54 1
Interview de Chat GPT : IA, intelligence, philosophie, géopolitique, post-vérité...
10 months ago 00:09:54 1
Elon Musk reveals SpaceX’s NEW MAJOR PLAN CHANGED at Starbase!
11 months ago 00:40:17 1
Data-Oriented Programming • Yehonathan Sharvit & James Lewis
12 months ago 00:10:01 1
Germany Has Lost Everything! Massive Company Lay Offs, Economic Crash Of A Lifetime Begins
1 year ago 00:39:39 1
Data-Oriented Programming • Yehonathan Sharvit & James Lewis • GOTO 2023