Bikeshedding Structured Concurrency

Alan Bateman alan.bateman at oracle.com
Fri Aug 1 08:28:04 UTC 2025


On 01/08/2025 06:05, David Alayachew wrote:
> Hello @loom-dev <mailto:loom-dev at openjdk.org>,
>
> I have been enjoying the Structured Concurrency JEP's as they have 
> come, and I am excited to try the JDK 25 variant with all the new 
> changes with Joiner.
>
> I have a bikeshed request.
>
> For Subtask, can we change the method name from exception() to 
> throwable()? It more accurately describes what is happening.
>

In j.u.concurrent there is 
CompletableFuture.completeExceptionally(Throwable)/obtrudeException(Throwable), 
SubmissionPublisher.closeExceptionally(Throwable), 
ForkJoinTask.getException and Future.exceptionNow() returning a 
Throwable, and a few more.

The main use of Subtask::exception will be a custom Joiner's onComplete 
implementation where handles the exception or error when the subtask 
fails. There is an argument that fork should be void or just return a 
Supplier (Subtask extends Supplier) but there hasn't been enough 
feedback from real-world usage to help that discussion.

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20250801/4a3dfad2/attachment-0003.htm>


More information about the loom-dev mailing list