New Early Access builds

Ron Pressler ron.pressler at oracle.com
Tue Jun 30 18:49:55 UTC 2020


You will need to write a custom Executor, more likely an ExecutorService. You’ll probably 
want to run the execution loop inside close, and perhaps in invokeAll/Any.

Please let us know how it works out.

Could you perhaps explain why this use-case is important to you and why using 
a simple single-worker executor that is not run on the current thread is unsatisfactory?

— Ron

On 30 June 2020 at 19:26:40, Mark Raynsford (org.openjdk at io7m.com) wrote:

On 2020-06-29T07:50:07 +0100  
Alan Bateman <Alan.Bateman at oracle.com> wrote:  

> There are a couple of API tweaks and renames. The "Getting started" [2]  
> has been updated so it is aligned with the current APIs.  
>  
> -Alan  
>  
> [1] http://jdk.java.net/loom/  
> [2] https://wiki.openjdk.java.net/display/loom/Getting+started  

Small question, as I'm a little uncertain:  

What is the correct way to say "Start a set of N virtual threads that  
all execute on the current carrier thread"?  

I have some code where I'd like:  

1. A non-virtual thread T to start a set S of virtual threads to perform  
various I/O operations...  
2. Have T wait for the virtual threads to complete...  
3. Then have T continue on its way afterwards, without at any point  
having to deal with synchronization (as it would if the threads in  
S were non-virtual, or were scheduled on different carrier threads).  

Is there actually something in the API currently to do this? It seems  
like all of the executors use a ForkJoin pool. I could write an  
executor myself, but it's not clear if I actually have to.  

--  
Mark Raynsford | https://www.io7m.com  



More information about the loom-dev mailing list