Structured Concurrency
Source jep480 (Java Enhancement Proposal) Original post introducing structured concurrency (2016) Summary of the jep480 document. Purpose of This Post Introduce a concurrency programming style that can eliminate common risks from cancellation and shutdown. Improve the observability of concurrent code. Motivation Developers manage complexity by dividing tasks into subtasks. In single-threaded code, subtasks are executed sequentially, but if subtasks are independent, running them concurrently can improve performance. However, managing many threads is very difficult. Unstructured concurrency with ExecutorService Example code using ExecutorService introduced in Java 5 for concurrency, showing what problems arise without structured concurrency. ...