Interface Task<V>
- Type Parameters:
V
- the value produced by the task upon completion.
- All Known Subinterfaces:
Task.Cancellable<V>
- All Known Implementing Classes:
VirtualThreadTask
public interface Task<V>
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> Task
<V> completedTask
(V value) join()
static <V> V
joinAndCancelOnInterrupt
(Task.Cancellable<V> task) static <V> V
joinAndCancelOnInterruptIfPossible
(Task<V> task) static <V> Task
<V> nonCancellable
(Task<V> task) static void
Spawns a new virtual thread that joins thetask
and does not attempt to catch exceptions.static <V> Task
<V>
-
Method Details
-
join
- Throws:
TaskException
InterruptedException
-
joinUninterruptibly
- Throws:
TaskException
-
completedTask
-
wrap
-
nonCancellable
-
joinAndCancelOnInterrupt
- Throws:
TaskException
-
joinAndCancelOnInterruptIfPossible
- Throws:
TaskException
-
uncatch
Spawns a new virtual thread that joins thetask
and does not attempt to catch exceptions. If one is thrown, the default uncaught exception handler for the VM will be invoked.
-