Skip to main content
PreparationZone Logo
PreparationZone
Back to Java

Java · Hard · Pro

StructuredTaskScope shutdown on failure — how avoid leaked tasks?

JavaConcurrencyStaff
Model answerPreview

StructuredTaskScope shutdown

StructuredTaskScope (preview/incubator) treats concurrent subtasks as a unit—if one fails, others are cancelled/interrupted and the scope closes so threads don't leak.