Timeouts in structured concurrency
Alan Bateman
alan.bateman at oracle.com
Fri Dec 19 06:49:05 UTC 2025
On 18/12/2025 21:00, David Alayachew wrote:
> :
>
> That said, if you dislike a 0 parameter call being forced into being a
> 2 paramefer call when you need to add timeout, then sure, I think
> adding an overload for that static method that takes in the
> configFunction is reasonable. I'd support that.
>
The no-arg open method is the only method uses the default configuration
and the "default" policy/joiner. We held back from adding a 1-arg open
method that takes a configuration function as it doubles down on the
defaults. We are confident that the "all of nothing" case is the most
important case, and this means the scope will be cancelled if any
subtask fails. It is harder to get a sense as to whether subtasks
produce results of the same type or different types, that is what
determines if the default is allSuccessfulOrThrow [1] or
awaitAllSuccessfulOrThrow [2].
-Alan
[1]
https://download.java.net/java/early_access/jdk26/docs/api/java.base/java/util/concurrent/StructuredTaskScope.Joiner.html#allSuccessfulOrThrow()
[2]
https://download.java.net/java/early_access/jdk26/docs/api/java.base/java/util/concurrent/StructuredTaskScope.Joiner.html#awaitAllSuccessfulOrThrow()
More information about the loom-dev
mailing list