A new build and a new structured concurrency API

forax at univ-mlv.fr forax at univ-mlv.fr
Thu Nov 18 10:09:56 UTC 2021


> From: "Alex Otenko" <oleksandr.otenko at gmail.com>
> To: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "Alan Bateman" <Alan.Bateman at oracle.com>, "loom-dev"
> <loom-dev at openjdk.java.net>
> Sent: Jeudi 18 Novembre 2021 10:55:56
> Subject: Re: A new build and a new structured concurrency API

> What do you mean - no point? I think that requires a proof that there really is
> no point. Which is going to be hard to do because all of the interactions are
> side-effecting, so you are setting up to prove there is never any problem from
> the absence of those side effects.

>From the javadoc of StructuredExecutor 
"StructuredExecutor defines the [ https://download.java.net/java/early_access/loom/docs/api/java.base/java/util/concurrent/StructuredExecutor.html#shutdown() | shutdown ] method to shut down an executor without closing it. Shutdown is useful for cases where a sub-task completes with a result (or exception) and the results of other unfinished tasks are no longer needed." 

So by definition, if you are using shudown() or Handler that uses shutdown(), it means that you are not interested in the result of the computation of the unfinished tasks. 

> Alex

Rémi 

> On Thu, 18 Nov 2021, 09:50 Remi Forax, < [ mailto:forax at univ-mlv.fr |
> forax at univ-mlv.fr ] > wrote:

>> ----- Original Message -----
>>> From: "Alex Otenko" < [ mailto:oleksandr.otenko at gmail.com |
>> > oleksandr.otenko at gmail.com ] >
>>> To: "Alan Bateman" < [ mailto:Alan.Bateman at oracle.com | Alan.Bateman at oracle.com
>> > ] >
>>> Cc: "loom-dev" < [ mailto:loom-dev at openjdk.java.net | loom-dev at openjdk.java.net
>> > ] >
>> > Sent: Jeudi 18 Novembre 2021 10:36:25
>> > Subject: Re: A new build and a new structured concurrency API

>> > I still fail to see what you win by not invoking onComplete. I see a lot of
>> > problems from indeterminism in other similar contexts.

>> If shutdown has been called, there is no point of trying to complete the parts
>> of the computation that was still running.


>> > Alex

>> Rémi


>>> On Thu, 18 Nov 2021, 07:29 Alan Bateman, < [ mailto:Alan.Bateman at oracle.com |
>> > Alan.Bateman at oracle.com ] > wrote:

>> >> On 17/11/2021 21:48, Alex Otenko wrote:
>> >> > :

>> >> > The docs say onComplete may not be invoked at all. What is being saved
>> >> > here, compared to cancel() that guarantees onComplete will be invoked.
>> >> I see Rémi and Ron have replied pointing out that your question is about
>> >> when the executor is shutdown. Just to add that isn't an anomaly with
>> >> cancel, it's just that the javadoc isn't clear. So if you are using
>> >> Future objects and you invoke a cancel method after the executor is
>> >> shutdown then it's not going to run the onComplete operation.

>> >> -Alan


More information about the loom-dev mailing list