Testing if target VM supports virtual threads
The following recommend way is temporary, to allow debuggers to distinguish JDK 17 EA builds from Loom EA builds.JDI VirtualMachine defines supportVirtualThreads() to test to check if the target VM supports virtual threads.The supportsVirtualThread boolean in the reply to the JDWP CapabilitiesNew command is the equivalentis version 19 or later. There is no way to determine if --enable-preview was set, but this is also unnecessary. The JDK 19 debug agent will still accept commands that are virtual thread specific, even if the JVM was not run with --enable-preview.
The following are not currently supported for virtual threads:
As a temporary solution to allow existing debuggers to 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 option that control controls this behavior areis:
|Option Name and Value||Description||Default|
|includevirtualthreads=y|n||List of all threads includes virtual threads as well as platform threads||n|