A New Early Access Build

Alan Bateman Alan.Bateman at oracle.com
Wed Jan 1 11:37:04 UTC 2020


On 01/01/2020 10:52, Dávid Karnok wrote:
> Hi. The following setup hangs for me, is this due to the mentioned nested
> scope issues right now?
>
>          var result = new AtomicReference<Boolean>();
>          try (var exec = Executors.newSingleThreadExecutor()) {
>              try (var scope =
> Executors.newUnboundedExecutor(Thread.builder().virtual(exec).factory())) {
>                  try (var scope2  =
> Executors.newUnboundedExecutor(Thread.builder().virtual(scope).factory())) {
>                      scope2.submit(() ->
> result.set(Thread.currentThread().isVirtual()));
>                  }
>              }
>          }
>
>          System.out.println(result.get());
>
This is trying to use a virtual thread as a carrier thread, essentially 
a "double piggyback". There are a couple of reasons why this won't work 
at this time. Did you mean to do this? If you change the second factory 
to use "exec" as the scheduler then it should work.

-Alan


More information about the loom-dev mailing list