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 {@link ManagementFactory#getThreadMXBean} method orfrom the {@link ManagementFactory#getPlatformMBeanServer platform MBeanServer} method.
The ObjectName for uniquely identifying the MXBean for the thread system within an MBeanServer is:
{@link ManagementFactory#THREAD_MXBEAN_NAME java.lang:type=Threading}
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 {@link #isThreadCpuTimeSupported} method can be used to determineif a Java virtual machine supports measuring of the CPU time for any thread. The {@link #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 {@link #isThreadCpuTimeEnabled} and {@link #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 {@link #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 {@link #setThreadContentionMonitoringEnabled} method can be used to enablethread contention monitoring.
The ThreadMXBean interface provides the {@link #findMonitorDeadlockedThreads} and {@link #findDeadlockedThreads} methods to find deadlocks inthe running application. @see JMX Specification. @see Ways to Access MXBeans @author Mandy Chung @version 1.20, 03/08/06 @since 1.5
|
|