public class Threads extends Object
This class consists exclusively of static methods that provide access to threads in the Java virtual machine. It is intended for use by debugging and monitoring tools.
Nested Class SummaryModifier and TypeClassDescription
static interfaceA handle to a thread executor.
virtualThreadsReturns the stream of the virtual threads that have been started but have not terminated. Returns an empty stream if tracking of virtual threads is not enabled.
This method requires that the Java virtual machine be started with the system property "
jdk.trackAllVirtualThreads" set to the value of "
true", otherwise virtual threads are not tracked.
- the stream of virtual threads
SecurityException- if denied by the security manager
executorsReturns the list of active thread executors owned by the given thread. The list is ordered, enclosing executors before nested executors.