- Loading...
VirtualThreads.allThreads() (and JDWP VirtualMachine/AllThreads) enumerates all active platform threads, virtual threads are not enumerated.
For thread dumps and troubleshooting purposes the debugger can invoke the com.sun.management.Threads API in the target VM to enumerate threads. This can be used as stop-gap solution until there is better support for structured debugging in the APIs.
Virtual threads are not active members of a thread group.
JDI ThreadGroupReference::threads (and JDWP ThreadGroupReference/Children) enumerate all active platform threads in a group, virtual threads are not enumerated.
ThreadStartRequest/ThreadDeathRequest define a new method to control whether thread start/end events are sent for all threads or only platform threads.
JDI ThreadReference defines isVirtual() to test if a thread is a virtual thread.
JDWP ThreadReference/IsVirtual is the equivalent.
The following is temporary, to allow debuggers to distinguish JDK 17 EA builds from Loom EA builds.
JDI VirtualMachine defines supportVirtualThreads() to test if the target VM supports virtual threads.
The supportsVirtualThread boolean in the reply to the JDWP CapabilitiesNew command is the equivalent.
The following are not currently supported for virtual threads:
As a temporary solution to allow existing debuggers work with virtual threads, the JDWP agent will track virtual threads so they can be enumerated for debuggers that want to enumerate all virtual threads. The options that control this behaviour are:
Option Name and Value | Description | Default |
---|---|---|
enumeratevthreads=y|n | thread lists include vthreads | n |
trackvthreads=some|all | track some or all vthreads | some |
fakevthreadstartevent=y|n | send fake start event when needed | y |
Project Loom Early Access builds
Slides from March 24, 2021 meeting with IntelliJ and Eclipse maintainers
Sample application (uses Helidon MP configured to run each service in its own virtual thread)
Eclipse Bug 527000 tracks adding support for virtual threads