Changes to JEP 453

Eric Kolotyluk eric at kolotyluk.net
Thu May 18 21:44:01 UTC 2023


     There are only two hard things in Computer Science: cache 
invalidation and naming things.

     -- Phil Karlton

So, what does "Subtask" mean when there is no "Task"?

Personally, I would go with either just "Task" or "StructuredScopeTask" 
as "Subtask" is sort of inventing new terminology.

If you renamed "StructuredTaskScope" to just "Task" then "Subtask" would 
make more sense as it is something spawned from a Task. This would be my 
preferred choice. Shorter names for common things... in particular 
things that should become common.

However, what is the relationship to "Task" with all those other things 
called "...Task..." Maybe just "ConcurrentTask" and "ConcurrentSubtask" 
are more meaningful, but "java.util.concurrent.Task" and 
"java.util.concurrent.Subtask" are probably clear enough.

In a sense, we would be saying that all Concurrent Tasks should be 
Structured.

Cheers, Eric

On 2023-05-18 11:59 a.m., Ron Pressler wrote:
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230518/91032679/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fWYk8D7XGdMvTRbm.png
Type: image/png
Size: 37091 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230518/91032679/fWYk8D7XGdMvTRbm-0001.png>


More information about the loom-dev mailing list