<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <br>
    <br>
    <div class="moz-cite-prefix">On 08/10/2025 15:57, Mengyang Li wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAJ_HiMsehhs4LW_m9yOL60KZ7pNM7rNc_fbR46PisFn3eRvbWQ@mail.gmail.com">
      
      <div dir="ltr">
        <div dir="ltr">
          <p class="gmail-p2"><br>
            ```<br>
          </p>
          <p class="gmail-p1">Console output:<br>
            ``` bash<br>
            WARNING: Using custom default scheduler, this is an
            experimental feature!<br>
            class java.lang.Thread<br>
            VirtualThread[#27,VirtualThreadA]/runnable RUNNABLE
            currentThread Thread[#3,main,5,main] current is virtual
            false<br>
            java.lang.RuntimeException<br>
                    at
io.github.dreamlike.CustomerVirtualThreadScheduler.execute(CustomerVirtualThreadScheduler.java:16)<br>
                    at
java.base/java.lang.VirtualThread.submitRunContinuation(VirtualThread.java:367)<br>
                    at
java.base/java.lang.VirtualThread.externalSubmitRunContinuationOrThrow(VirtualThread.java:456)<br>
                    at
            java.base/java.lang.VirtualThread.start(VirtualThread.java:734)<br>
                    at
            java.base/java.lang.VirtualThread.start(VirtualThread.java:745)<br>
                    at
java.base/java.lang.ThreadBuilders$VirtualThreadBuilder.start(ThreadBuilders.java:257)<br>
                    at io.github.dreamlike.VTMain.main(VTMain.java:14)<br>
            ```<br>
            <br>
          </p>
          <p class="gmail-p1">After checking the relevant code, it seems
            that execution goes through the <span class="gmail-s1"><b>first
                branch</b></span> below.</p>
          <p class="gmail-p1">This behavior doesn’t appear to align with
            the semantics of a custom scheduler — the nested virtual
            thread is submitted directly to <span class="gmail-s2">ct.getPool()</span> instead
            of going through <span class="gmail-s2">CustomerVirtualThreadScheduler::execute</span>.<br>
          </p>
        </div>
      </div>
    </blockquote>
    Thanks for the mail. You are correct. There is confusion between the
    "custom default scheduler" and the "built-in default scheduler" when
    the former delegates to the latter. I'll sort it out.<br>
    <br>
    -Alan<br>
  </body>
</html>