A DESCRIPTION OF THE PROBLEM :
The comment of StructuredTaskScope#allUntil says:
* <p> The following example uses {@code allUntil} to wait for all subtasks to
* complete without any cancellation. This is similar to {@link #awaitAll()}
* except that it yields a stream of the completed subtasks.
* {@snippet lang=java :
* <T> List<Subtask<T>> invokeAll(Collection<Callable<T>> tasks) throws InterruptedException {
* try (var scope = StructuredTaskScope.open(Joiner.<T>allUntil(_ -> false))) {
* tasks.forEach(scope::fork);
* return scope.join().toList();
* }
* }
* }
But instead of a stream, the example below returns a list.
The comment of StructuredTaskScope#allUntil says:
* <p> The following example uses {@code allUntil} to wait for all subtasks to
* complete without any cancellation. This is similar to {@link #awaitAll()}
* except that it yields a stream of the completed subtasks.
* {@snippet lang=java :
* <T> List<Subtask<T>> invokeAll(Collection<Callable<T>> tasks) throws InterruptedException {
* try (var scope = StructuredTaskScope.open(Joiner.<T>allUntil(_ -> false))) {
* tasks.forEach(scope::fork);
* return scope.join().toList();
* }
* }
* }
But instead of a stream, the example below returns a list.
- caused by
-
JDK-8342486 Implement JEP 505: Structured Concurrency (Fifth Preview)
-
- Resolved
-