JUG Milano Meeting #175
Giovedì 19 Novembre 2026
Flights, Failures and Forks: Structured Concurrency and Algebraic Data Types in Java
L'incontro si terrà Giovedì 19 Novembre 2026 presso eDream ODIGEO Via Fara 26 20124 Milano - evento gratuito previa registrazione OBBLIGATORIA (vedi dettagli) (mappa) in Via Gustavo Fara, 26, 20124 Milano MI .
Il talk sarà in Italiano.
Evento ibrido online ed in presenza.
La partecipazione **in presenza** è gratuita e libera, ma è OBBLIGATORIA la registrazione su: form di registrazione per partecipare a JUG Milano in presenza
La partecipazione **in presenza** è gratuita e libera, ma è OBBLIGATORIA la registrazione su: form di registrazione per partecipare a JUG Milano in presenza
Abstract dell'intervento:
Asking five airlines for a price at the same time sounds easy. Then one provider hangs, another fails, the user gives up, and your ExecutorService keeps running threads that nobody is waiting for anymore.
In this live coding session, we build a flight search aggregator from scratch in modern Java. First we model what can happen. Using records, sealed interfaces, and exhaustive pattern matching, every provider answer becomes a type (an offer, sold out, service down, too slow), and the compiler won't let us forget a case. Then we make the runtime respect that model. With StructuredTaskScope, still a preview API in JDK 27, concurrent calls start and end inside their parent: when one fails, the others are canceled; when time runs out, nothing is left behind; and the stack trace still tells a coherent story.
Along the way, we look inside structured concurrency to see how it works: scopes, subtasks, joiners, cancellation, and why virtual threads make it cheap. We finish by writing our own Joiner, where algebraic data types and structured concurrency meet to pick the best offer.
You will leave with a way to write concurrent Java where types make illegal states unrepresentable, and scope makes leaked threads impossible.
Asking five airlines for a price at the same time sounds easy. Then one provider hangs, another fails, the user gives up, and your ExecutorService keeps running threads that nobody is waiting for anymore.
In this live coding session, we build a flight search aggregator from scratch in modern Java. First we model what can happen. Using records, sealed interfaces, and exhaustive pattern matching, every provider answer becomes a type (an offer, sold out, service down, too slow), and the compiler won't let us forget a case. Then we make the runtime respect that model. With StructuredTaskScope, still a preview API in JDK 27, concurrent calls start and end inside their parent: when one fails, the others are canceled; when time runs out, nothing is left behind; and the stack trace still tells a coherent story.
Along the way, we look inside structured concurrency to see how it works: scopes, subtasks, joiners, cancellation, and why virtual threads make it cheap. We finish by writing our own Joiner, where algebraic data types and structured concurrency meet to pick the best offer.
You will leave with a way to write concurrent Java where types make illegal states unrepresentable, and scope makes leaked threads impossible.
A cura di Riccardo Cardin:
WHO AM I
- Senior Software Engineer, Lastminute.com
- Main lecturer at the University of Padua (Software Engineering)
- Passionate blogger at Rock The JVM
- Maintainer of many OS projects both in Scala and Kotlin
WHO AM I
- Senior Software Engineer, Lastminute.com
- Main lecturer at the University of Padua (Software Engineering)
- Passionate blogger at Rock The JVM
- Maintainer of many OS projects both in Scala and Kotlin
Al termine dell'incontro, per chi lo desidera, andremo a mangiare qualcosa tutti insieme.