Changes to JEP 453
Remi Forax
forax at univ-mlv.fr
Fri May 19 13:24:20 UTC 2023
----- Original Message -----
> From: "Ron Pressler" <ron.pressler at oracle.com>
> To: "loom-dev" <loom-dev at openjdk.org>
> Sent: Thursday, May 18, 2023 8:59:54 PM
> Subject: Changes to JEP 453
> Hi.
Hi
>
> We have made several changes to structured concurrency (JEP 453) due to
> feedback:
>
> 1. We've renamed `TaskHandle` to `Subtask`. I can't promise it's the last rename
> :)
If you are into the renaming, i propose to rename join/joinUntil to joinAll/joinAllUntil so it's clear that join() has to be called once per a group of subtasks and not once per subtask.
>
> 2. We've fixed the generic signature of handleComplete (thank you Rémi for
> pointing out the mistake)
>
> 3. We've changed the states and behaviour of subtasks on cancellation. Subtasks
> that are forked after `shutdown` is called will have the `STILLBORN` state.
> Running subtasks will be interrupted, but the state of their `Subtask` will
> remain `RUNNING` until completed, probably sometime after `join` has returned,
> because `join` returns immediately when `shutdown` is called. When completed,
> their `Subtasks` will be passed to `handleComplete`, either in the `FAILED` or
> `SUCCESS` state. I.e., Unlike `Future`, the state reflects the state of the
> task itself, not of the handle.
In the JEP, the state CANCELLED has disappeared from the possible state of Subtask ?
I'm puzzled by this change.
>
> 4. We've added the com.sun.management.Threads.currentThreadEnclosingScopes()
> method that returns a string with the description of the current structured
> context -- i.e. the stack trace for the current thread and the enclosing scopes
> with their owners' respective stack traces -- all the way up the hierarchy.
>
> https://openjdk.org/jeps/453
Minor detail, in the code of the example runAll(), the local variable 'handles' should be renamed to 'suppliers', and i do not believe it has to be typed List<? extends Supplier<T>>, List<Supplier<T>> should be enough.
>
>
> -- Ron
Rémi
More information about the loom-dev
mailing list