<div dir="ltr">Hi,<div><br></div><div>I am trying to use virtual threads together with the ScheduledExecutorService but I am uncertain what is the best way to do so. To use the ExecutorService with virtual threads we would use Executors.newVirtualThreadPerTaskExecutor() but there seems to be no equivalent method for the ScheduledExecutorService. </div><div><br></div><div>Executors.newScheduledThreadPool(int, ThreadFactory) would require pooling virtual threads which I believe is considered bad practice.</div><div>Executors.newSingleThreadScheduledExecutor(ThreadFactory) only allows for a single thread so tasks must execute sequentially.</div><div><br></div><div>The best way I've found so far is in this StackOverflow answer (<a href="https://stackoverflow.com/a/76599122" target="_blank">https://stackoverflow.com/a/76599122</a>) which suggests using both a single-threaded ScheduledExecutorService and Executors.newVirtualThreadPerTaskExecutor(). This works but perhaps the Executors API should directly support this via Executors.newVirtualThreadPerTaskScheduledExecutor() ?</div></div>