WORKSHOP
J On the Beach
Structured Concurrency in Action
Java · Concurrency · Scaling
In Java 25, the structured concurrency API sees its fifth preview with considerable changes over previous iterations. With chances being good that it will finalize without a further overhaul, let's put it into action and explore how to:
- - Structure concurrent code
- - Process and propagate errors and cancellation
- - Observe thread relationships
- - Refactor from a reactive approach
After this hands-on lab you'll be ready to put the structured concurrency API into action in your project.
Key Takeaways
- How virtual threads enable the thread-per-task programming model while scaling to large numbers of concurrent tasks.
- Understanding the principles of structured concurrency and how it simplifies concurrent application design.
- Using Java's
StructuredTaskScopeto manage concurrent subtasks, results, errors, and timeouts. - How structured concurrency improves readability, maintainability, and correctness compared to traditional concurrency approaches.
- Building applications where concurrent workflows naturally compose across multiple layers without explicit coordination.
Target Audience
- Software developers interested in modern concurrency patterns in Java.
- Architects looking to build scalable applications while maintaining clean and understandable code.
- Java developers who want hands-on experience with virtual threads and structured concurrency.
Requirements
- Proficiency in Java 8 or later.
- Basic understanding of concurrent programming concepts.
- A laptop with Git, Java 25, Maven, and a preferred editor or IDE installed.
- A GitHub account.
Schedule
Workshop Plan
Introduction to Modern Java Concurrency (20 min)
- Challenges of traditional thread management.
- Why Java introduced virtual threads.
- Understanding the thread-per-task model.
Working with Virtual Threads (35 min)
- Creating and managing virtual threads.
- Comparing platform threads and virtual threads.
- Exploring scalability and performance considerations.
Structured Concurrency in Practice (45 min)
- Principles and benefits of structured concurrency.
- Using
StructuredTaskScopeto coordinate concurrent work. - Managing results, failures, cancellations, and timeouts.
- Hands-on exercises with concurrent workflows.
Composition Patterns and Real-World Applications (15 min)
- Composing concurrent tasks across application layers.
- Common patterns and anti-patterns.
- Applying structured concurrency in production systems.