The management interface for the thread system of the Java virtual machine.
A Java virtual machine has a single instance of the implementation
class of this interface. This instance implementing this interface is
an MXBean
that can be obtained by calling
the ManagementFactory.getThreadMXBean method or
from the platform MBeanServer method.
The ObjectName for uniquely identifying the MXBean for the thread system within an MBeanServer is:
java.lang:type=Threading
It can be obtained by calling the
PlatformManagedObject.getObjectName method.
java.lang.Thread.getId method for a thread.
The thread ID is unique during its lifetime. When a thread
is terminated, this thread ID may be reused.
Some methods in this interface take a thread ID or an array of thread IDs as the input parameter and return per-thread information.
The isThreadCpuTimeSupported method can be used to determine
if a Java virtual machine supports measuring of the CPU time for any
thread. The isCurrentThreadCpuTimeSupported method can
be used to determine if a Java virtual machine supports measuring of
the CPU time for the current thread.
A Java virtual machine implementation that supports CPU time measurement
for any thread will also support that for the current thread.
The CPU time provided by this interface has nanosecond precision but not necessarily nanosecond accuracy.
A Java virtual machine may disable CPU time measurement
by default.
The isThreadCpuTimeEnabled and setThreadCpuTimeEnabled
methods can be used to test if CPU time measurement is enabled
and to enable/disable this support respectively.
Enabling thread CPU measurement could be expensive in some
Java virtual machine implementations.
The isThreadContentionMonitoringSupported method can be used to
determine if a Java virtual machine supports thread contention monitoring.
The thread contention monitoring is disabled by default. The
setThreadContentionMonitoringEnabled method can be used to enable
thread contention monitoring.
getThreadInfo(long[], boolean, boolean) and
dumpAllThreads methods can be used to obtain the thread stack trace
and synchronization information including which
lock a thread is blocked to
acquire or waiting on and which locks the thread currently owns.
The ThreadMXBean interface provides the
findMonitorDeadlockedThreads and
findDeadlockedThreads methods to find deadlocks in
the running application.
extends
ManagementFactory.getPlatformMXBeans(Class),
JMX Specification.,
Ways to Access MXBeans