79133597

Date: 2024-10-28 13:32:07
Score: 1
Natty:
Report link

The root thread container of the JVM in the ThreadContainers class maintains a list of all virtual threads by default (this behavior can be disabled using the jdk.trackAllThreads system property, before java 21 this defaulted to false, I think). Unfortunately, the ThreadContainers class, as well as the ThreadContainer class, both belong to the jdk.internal module and are therefore inaccessible. All other classes using these are also part of the jdk.internal module or don't give us access to this list of threads.

Additionally, the ThreadContainers class maintains a list of all executor instances, including those that create virtual threads, which internally have a list of all their virtual threads, but this list of executors is also inaccessible.

Even the ThreadDumper class, which can now create thread dumps including virtual threads, is inside the jdk.internal module.

The documentation of ThreadGroup and other classes and methods you mentioned state they do not return virtual threads.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Max