<div dir="ltr">Google search for a similar use case led me to this discussion.<div><br></div><div>It seems that API has changed in the latest builds. </div><div><br></div><div>What is the current way to achieve the following?</div><div><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Thread.builder().virtual(Executors.newSingleThreadExecutor()).factory()</pre><div>Thanks,</div><div>Mushtaq</div><div><br></div><div>-----------------------------------------------------</div><div>Reference to the original thread (in case this email shows up outside the original thread, not sure how mailman works):</div><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><pre style="white-space:pre-wrap">Remember, you want multiple virtual threads, but use only on platform
thread to schedule them. So you need to pass the single-thread executor 
as the virtual thread scheduler:</pre>    ThreadFactory tf = Thread.builder().virtual(Executors.newSingleThreadExecutor()).factory();

And then you can use the thread factory directly to create virtual threads,
or use it like so:

    ExecutorService e = Executors.newUnboundedExecutor(tf);

- Ron</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><br></pre></div></div>