How I currently use structured concurrency

Josiah Noel josiahnoel at gmail.com
Mon May 15 14:27:33 UTC 2023


> I think that combining join with throwIsFailed is perfectly reasonable,
> and it even was a design we considered but preferred the STS one for
> pedagogical reasons (we hope to learn if that decision was the right one).


I actually don't mind that they are separate, to be honest.


> But representing cancellation (i.e. interruption) — a perfectly valid
> behaviour for correct code even in the case of no environmental errors — as
> an unchecked exception, which usually represents a bug, is not the Java
> way. Obviously anyone is free to do that, but it’s not something we would
> consider for a standard API.
>

The interrupted exception is a necessary evil I suppose. Still, it sure
would be convenient if throwIfFailed could have an unchecked version for
those cases where none of the subtasks in a scope throw any checked
exceptions. Perhaps we could have an alternate version of STS which
accepts Supplier instead of Callable?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230515/d10dd052/attachment.htm>


More information about the loom-dev mailing list