Comment Comment by mping As I understand it, structured concurrency is part of the same deliverable, tracked in this JEP: https://openjdk.org/jeps/428Here's the example from the JEP: Response handle() throws ExecutionException, InterruptedException { try (var scope = new StructuredTaskScope.ShutdownOnFailure()) { Future<String> user = scope.fork(() -> findUser()); Future<Integer> order = scope.fork(() -> fetchOrder()); scope.join(); // Join both forks scope.throwIfFailed(); // ... and propagate errors // Here, both forks have succeeded, so compose their results return new Response(user.resultNow(), order.resultNow()); } } parent mping 4 years ago
Here's the example from the JEP: