Module java.base

Class StructuredTaskScope.ShutdownOnSuccess<T>

java.lang.Object
java.util.concurrent.StructuredTaskScopePREVIEW<T>
java.util.concurrent.StructuredTaskScope.ShutdownOnSuccess<T>
Type Parameters:
T - the result type
All Implemented Interfaces:
AutoCloseable
Enclosing class:
StructuredTaskScopePREVIEW<T>

public static final class StructuredTaskScope.ShutdownOnSuccess<T> extends StructuredTaskScopePREVIEW<T>
ShutdownOnSuccess is a preview API of the Java platform.
Programs can only use ShutdownOnSuccess when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A StructuredTaskScope that captures the result of the first subtask to complete successfullyPREVIEW. Once captured, it shuts downPREVIEW the task scope to interrupt unfinished threads and wakeup the task scope owner. The policy implemented by this class is intended for cases where the result of any subtask will do ("invoke any") and where the results of other unfinished subtasks are no longer needed.

Unless otherwise specified, passing a null argument to a method in this class will cause a NullPointerException to be thrown.

API Note:
This class implements a policy to shut down the task scope when a subtask completes successfully. There shouldn't be any need to directly shut down the task scope with the shutdownPREVIEW method.
Since:
21