Changes to JEP 453

Ron Pressler ron.pressler at oracle.com
Thu May 18 18:59:54 UTC 2023


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 :)

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.

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


-- Ron



More information about the loom-dev mailing list