Structured concurrency is a new way to use multithreading in Java. It allows developers to think about work in logical groups while taking advantage of both traditional and virtual threads. Available in preview in Java 21, structured concurrency is a key aspect of Java’s future, so now is a good time to start working with it.
Writing concurrent software is one of the greatest challenges for software developers. Java’s thread model makes it a strong contender among concurrent languages, but multithreading has always been inherently tricky. The name "structured concurrency" comes from structured programming. In essence, it provides a way to write concurrent software using familiar program flows and constructs. This lets developers focus on the jobs that need to be done. As the JEP for structured concurrency says, "If a task splits into concurrent subtasks then they all return to the same place, namely the task's code block."