<div dir="ltr"><div>How do I list all the virtual threads in a JVM? <code>ThreadMXBean.dumpAllThreads()</code>, <code>ThreadMXBean.getAllThreadIds()</code>, <code>ThreadGroup.enumerate()</code>, and <code>Thread.getAllStackTraces()</code> do not return virtual threads.  See my question at <a class="gmail-x_moz-txt-link-freetext" id="gmail-LPlnk648813" rel="noopener noreferrer" target="_blank" href="https://stackoverflow.com/questions/79110874/list-the-virtual-threads-in-java">https://stackoverflow.com/questions/79110874/list-the-virtual-threads-in-java</a>.</div><div><br></div><div>I can see how these APIs would not scale for virtual threads.  What are the thoughts for an API to list all the virtual threads?  
For an in-process API, would an API that returns Stream<Thread> scale?  I am not sure how an MXBean API can stream Threads to make it scale.<br></div><div><br></div><br></div>