Bikeshedding Structured Concurrency

David Alayachew davidalayachew at gmail.com
Fri Aug 1 11:51:18 UTC 2025


Thanks for the responses everyone. It appears that there are several
examples that return too. Sounds like the reason is convention then.

I guess a better question might be, why were all these API's named with
Exception rather than Throwable in the first place? What benefit is there
in naming it Exception?

On Fri, Aug 1, 2025, 4:47 AM Remi Forax <forax at univ-mlv.fr> wrote:

>
>
> ------------------------------
>
> *From: *"Alan Bateman" <alan.bateman at oracle.com>
> *To: *"David Alayachew" <davidalayachew at gmail.com>, "loom-dev" <
> loom-dev at openjdk.org>
> *Sent: *Friday, August 1, 2025 10:28:04 AM
> *Subject: *Re: Bikeshedding Structured Concurrency
>
> On 01/08/2025 06:05, David Alayachew wrote:
>
> Hello @loom-dev <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.
>
>
> yes, also Future.exceptionNow().
>
>
>
> 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
>
>
> Rémi
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20250801/e4947be0/attachment-0001.htm>


More information about the loom-dev mailing list