DZone Java Zone
Follow
Understanding Structured Concurrency in Java
Typically, complexity in programming is managed by breaking down tasks into subtasks. These subtasks can then be executed concurrently.Since Java 5, ExecutorService API helps the programmer execute these subtasks concurrently. However, given the nature of concurrent execution, each subtask could fail or succeed independently with no implicit communication between them. The failure of one subtask does not automatically cancel the other subtasks. Although an attempt can be made to manage this cancellation manually via external handling, it's quite tricky to get it right — especially when a large number of subtasks are involved.