My experience with Structured Concurrency
Alan Bateman
alan.bateman at oracle.com
Sat Aug 16 08:52:57 UTC 2025
On 15/08/2025 19:44, David Alayachew wrote:
> :
>
> So, when someone recently challenged me to use Joiners (rather than
> the old STS preview versions I was used to), I started creating
> Joiners to handle all sorts of failure and outcomes. At first, a lot
> of them could be handled by the Joiner.awaitUntil(), where I would
> just check and see if the task failed, then handle the error. But as I
> got further and further along, I started needing to add state to my
> Joiners in order to get the failure handling that I wanted. For
> example, if a certain number of timeouts occur, cancel the scope.
> Well, that necessitates an AtomicNumber.
>
I assume you mean allUntil(Predicate), which is intended to make it easy
to create a Joiner that implements a cancellation policy. Joiners are
inherently stateful as many will accumulate results or exceptions, or
maybe just count failures. With allUntil then it does mean that the
predicate may not be pure function, is that the reason for the
hesitation? Beyond allUntil does mean implementing the Joiner interface.
I think your mails are pondering whether there is something between
allUntil and implementing Joiner yourself. I don't think we've had
enough feedback to date to know if there is something needed there. One
thing that would help is if your could enumerate a few of the Joiners
that you implemented. I'm wondering if they are general purpose of very
specific.
-Alan
More information about the loom-dev
mailing list