[External] : Re: A new build and a new structured concurrency API

Ron Pressler ron.pressler at oracle.com
Tue Nov 16 01:01:15 UTC 2021



> On 16 Nov 2021, at 00:33, Mike Rettig <mike.rettig at gmail.com> wrote:
> 
> 
> >> StructuredExecutor.open(String name, ThreadFactory factory)
> 
> Does it require a thread per task? Why not create a new interface called TaskExecutor that could be backed by a virtual thread per task, a platform thread per task, or a thread pool? 
> 

The only difference between what you’re suggesting and what we have here is the thread pool. That’s an option that loses the goals described in the JEP of representation relationships among threads while gaining nothing.


> 
> Task can be an interface that provides the basic start, join, and interrupt methods. Since it is a new interface it could add task specific methods like cancel.
> 


This API does have a cancellation method called shutdown (there’s a reason why it isn’t named "cancel"). The issue with 
interruption isn’t how to trigger it, but how to respond to it, and it would have to work will all existing code that is 
already built around interruption.

What would be helpful is if you could provide feedback on your experience with the proposed feature — what you tried, what 
worked well, what didn’t — rather than ask for a different one.

— Ron



More information about the loom-dev mailing list