T
- the result typeSupplier<T>
StructuredTaskScopePREVIEW<T>
public static sealed interface StructuredTaskScope.Subtask<T> extends Supplier<T>
Subtask
is a preview API of the Java platform. StructuredTaskScope.fork(Callable)
PREVIEW.Modifier and Type | Interface | Description |
---|---|---|
static enum |
StructuredTaskScope.Subtask.StatePREVIEW |
Preview. Represents the state of a subtask. |
Modifier and Type | Method | Description |
---|---|---|
Throwable |
exception() |
Returns the exception thrown by the subtask. |
T |
get() |
Returns the result of the subtask. |
StructuredTaskScope.Subtask.StatePREVIEW |
state() |
Returns the state of the subtask. |
Callable |
task() |
Returns the value returning task provided to the fork method. |
Callable<? extends T> task()
fork
method.handleComplete
PREVIEW.fork
methodStructuredTaskScope.Subtask.StatePREVIEW state()
T get()
To ensure correct usage, if the scope owner forksPREVIEW a subtask, then it must join (with join
PREVIEW or joinUntil
PREVIEW) before it can obtain the result of the subtask.
get
in interface Supplier<T>
IllegalStateException
- if the subtask has not completed, did not complete successfully, or the current thread is the task scope owner and did not join after forkingThrowable exception()
To ensure correct usage, if the scope owner forksPREVIEW a subtask, then it must join (with join
PREVIEW or joinUntil
PREVIEW) before it can obtain the exception thrown by the subtask.
IllegalStateException
- if the subtask has not completed, completed with a result, or the current thread is the task scope owner and did not join after forking
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/StructuredTaskScope.Subtask.html
Subtask
when preview features are enabled.