Interface ThreadMXBean
- All Superinterfaces:
- PlatformManagedObject
- All Known Subinterfaces:
- ThreadMXBean
 ThreadMXBean supports monitoring and management of
 platform threads in the Java
 virtual machine. Platform threads are typically mapped to kernel
 threads scheduled by the operating system.  ThreadMXBean
 does not support monitoring or management of virtual threads.
 
 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.
 Thread ID
Thread ID is a positive long value returned by calling the thread'sthreadId() method.
 The thread ID is unique during its lifetime.  When the thread terminates,
 its 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.
Thread CPU time
A Java virtual machine implementation may support measuring the CPU time for the current platform thread, for any platform thread, or for no threads.
 The isThreadCpuTimeSupported() method can be used to determine
 if a Java virtual machine supports measuring of the CPU time for any
 platform thread.  The isCurrentThreadCpuTimeSupported() method
 can be used to determine if a Java virtual machine supports measuring of
 the CPU time with the getCurrentThreadCpuTime() and
 getCurrentThreadUserTime() methods from a platform 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(boolean)
 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.
 
Thread Contention Monitoring
Some Java virtual machines may support thread contention monitoring. When thread contention monitoring is enabled, the accumulated elapsed time that the thread has blocked for synchronization or waited for notification will be collected and returned in theThreadInfo object.
 
 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(boolean) method can be used to enable
 thread contention monitoring.
 
Synchronization Information and Deadlock Detection
Some Java virtual machines may support monitoring of object monitor usage and ownable synchronizer usage. ThegetThreadInfo(long[], boolean, boolean) and
 dumpAllThreads(boolean, boolean) 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.
- Since:
- 1.5
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptiondumpAllThreads(boolean lockedMonitors, boolean lockedSynchronizers) Returns the thread info for all live platform threads with stack trace and synchronization information.default ThreadInfo[]dumpAllThreads(boolean lockedMonitors, boolean lockedSynchronizers, int maxDepth) Returns the thread info for all live platform threads with stack trace of the specified maximum number of elements and synchronization information.long[]Finds cycles of platform threads that are in deadlock waiting to acquire object monitors or ownable synchronizers.long[]Finds cycles of platform threads that are in deadlock waiting to acquire object monitors.long[]Returns the threadIDs of all live platform threads.longReturns the total CPU time for the current thread in nanoseconds.longReturns the CPU time that the current thread has executed in user mode in nanoseconds.intReturns the current number of live platform threads that are daemon threads.intReturns the peak live platform thread count since the Java virtual machine started or peak was reset.intReturns the current number of live platform threads including both daemon and non-daemon threads.longgetThreadCpuTime(long id) Returns the total CPU time for a thread of the specified ID in nanoseconds.getThreadInfo(long id) Returns the thread info for a thread of the specifiedidwith no stack trace.getThreadInfo(long[] ids) Returns the thread info for each thread whose ID is in the input arrayidswith no stack trace.getThreadInfo(long[] ids, boolean lockedMonitors, boolean lockedSynchronizers) Returns the thread info for each thread whose ID is in the input arrayids, with stack trace and synchronization information.default ThreadInfo[]getThreadInfo(long[] ids, boolean lockedMonitors, boolean lockedSynchronizers, int maxDepth) Returns the thread info for each thread whose ID is in the input arrayids, with stack trace of the specified maximum number of elements and synchronization information.getThreadInfo(long[] ids, int maxDepth) Returns the thread info for each thread whose ID is in the input arrayids, with stack trace of a specified number of stack trace elements.getThreadInfo(long id, int maxDepth) Returns a thread info for a thread of the specifiedid, with stack trace of a specified number of stack trace elements.longgetThreadUserTime(long id) Returns the CPU time that a thread of the specified ID has executed in user mode in nanoseconds.longReturns the total number of platform threads created and also started since the Java virtual machine started.booleanTests if the Java virtual machine supports CPU time measurement from a platform thread with thegetCurrentThreadCpuTime()andgetCurrentThreadUserTime()methods.booleanTests if the Java virtual machine supports monitoring of object monitor usage.booleanTests if the Java virtual machine supports monitoring of ownable synchronizer usage.booleanTests if thread contention monitoring is enabled.booleanTests if the Java virtual machine supports thread contention monitoring.booleanTests if thread CPU time measurement is enabled.booleanTests if the Java virtual machine implementation supports CPU time measurement for any platform thread.voidResets the peak thread count to the current number of live platform threads.voidsetThreadContentionMonitoringEnabled(boolean enable) Enables or disables thread contention monitoring.voidsetThreadCpuTimeEnabled(boolean enable) Enables or disables thread CPU time measurement.Methods declared in interface java.lang.management.PlatformManagedObjectgetObjectName
- 
Method Details- 
getThreadCountint getThreadCount()Returns the current number of live platform threads including both daemon and non-daemon threads. The count does not include virtual threads.- Returns:
- the current number of live platform threads.
 
- 
getPeakThreadCountint getPeakThreadCount()Returns the peak live platform thread count since the Java virtual machine started or peak was reset. The count does not include virtual threads.- Returns:
- the peak live platform thread count.
 
- 
getTotalStartedThreadCountlong getTotalStartedThreadCount()Returns the total number of platform threads created and also started since the Java virtual machine started. The count does not include virtual threads.- Returns:
- the total number of platform threads started.
 
- 
getDaemonThreadCountint getDaemonThreadCount()Returns the current number of live platform threads that are daemon threads. The count does not include virtual threads.- Returns:
- the current number of live platform threads that are daemon threads.
 
- 
getAllThreadIdslong[] getAllThreadIds()Returns the threadIDs of all live platform threads. The thread IDs of virtual threads are not included. Some threads included in the returned array may have been terminated when this method returns.- Returns:
- an array of long, each is a thread ID.
 
- 
getThreadInfoReturns the thread info for a thread of the specifiedidwith no stack trace. This method is equivalent to calling:getThreadInfo(id, 0);This method returns a ThreadInfoobject representing the thread information for the thread of the specified ID. The stack trace, locked monitors, and locked synchronizers in the returnedThreadInfoobject will be empty. If a thread of the given ID is a virtual thread, is not alive, or does not exist, then this method will returnnull. A thread is alive if it has been started and has not yet terminated.MBeanServer access: 
 The mapped type ofThreadInfoisCompositeDatawith attributes as specified in theThreadInfo.frommethod.- Parameters:
- id- the thread ID of the thread. Must be positive.
- Returns:
- a ThreadInfoobject for the thread of the given ID with no stack trace, no locked monitor and no synchronizer info;nullif the thread of the given ID is a virtual thread, is not alive, or it does not exist.
- Throws:
- IllegalArgumentException- if- id <= 0.
 
- 
getThreadInfoReturns the thread info for each thread whose ID is in the input arrayidswith no stack trace. This method is equivalent to calling:getThreadInfo(ids, 0);This method returns an array of the ThreadInfoobjects. The stack trace, locked monitors, and locked synchronizers in eachThreadInfoobject will be empty. If a thread of the given ID is a virtual thread, is not alive, or does not exist, the corresponding element in the returned array will containnull. A thread is alive if it has been started and has not yet terminated.MBeanServer access: 
 The mapped type ofThreadInfoisCompositeDatawith attributes as specified in theThreadInfo.frommethod.- Parameters:
- ids- an array of thread IDs.
- Returns:
- an array of the ThreadInfoobjects, each containing information about a thread whose ID is in the corresponding element of the input array of IDs with no stack trace, no locked monitor and no synchronizer info.
- Throws:
- IllegalArgumentException- if any element in the input array- idsis- <= 0.
 
- 
getThreadInfoReturns a thread info for a thread of the specifiedid, with stack trace of a specified number of stack trace elements. ThemaxDepthparameter indicates the maximum number ofStackTraceElementto be retrieved from the stack trace. IfmaxDepth == Integer.MAX_VALUE, the entire stack trace of the thread will be dumped. IfmaxDepth == 0, no stack trace of the thread will be dumped. This method does not obtain the locked monitors and locked synchronizers of the thread.When the Java virtual machine has no stack trace information about a thread or maxDepth == 0, the stack trace in theThreadInfoobject will be an empty array ofStackTraceElement.If a thread of the given ID is a virtual thread, is not alive, or does not exist, this method will return null. A thread is alive if it has been started and has not yet terminated.MBeanServer access: 
 The mapped type ofThreadInfoisCompositeDatawith attributes as specified in theThreadInfo.frommethod.- Parameters:
- id- the thread ID of the thread. Must be positive.
- maxDepth- the maximum number of entries in the stack trace to be dumped.- Integer.MAX_VALUEcould be used to request the entire stack to be dumped.
- Returns:
- a ThreadInfoof the thread of the given ID with no locked monitor and synchronizer info.nullif the thread of the given ID is a virtual thread, is not alive or it does not exist.
- Throws:
- IllegalArgumentException- if- id <= 0.
- IllegalArgumentException- if- maxDepth is negative.
 
- 
getThreadInfoReturns the thread info for each thread whose ID is in the input arrayids, with stack trace of a specified number of stack trace elements. ThemaxDepthparameter indicates the maximum number ofStackTraceElementto be retrieved from the stack trace. IfmaxDepth == Integer.MAX_VALUE, the entire stack trace of the thread will be dumped. IfmaxDepth == 0, no stack trace of the thread will be dumped. This method does not obtain the locked monitors and locked synchronizers of the threads.When the Java virtual machine has no stack trace information about a thread or maxDepth == 0, the stack trace in theThreadInfoobject will be an empty array ofStackTraceElement.This method returns an array of the ThreadInfoobjects, each is the thread information about the thread with the same index as in theidsarray. If a thread of the given ID is a virtual thread, is not alive, or does not exist,nullwill be set in the corresponding element in the returned array. A thread is alive if it has been started and has not yet terminated.MBeanServer access: 
 The mapped type ofThreadInfoisCompositeDatawith attributes as specified in theThreadInfo.frommethod.- Parameters:
- ids- an array of thread IDs
- maxDepth- the maximum number of entries in the stack trace to be dumped.- Integer.MAX_VALUEcould be used to request the entire stack to be dumped.
- Returns:
- an array of the ThreadInfoobjects, each containing information about a thread whose ID is in the corresponding element of the input array of IDs with no locked monitor and synchronizer info.
- Throws:
- IllegalArgumentException- if- maxDepth is negative.
- IllegalArgumentException- if any element in the input array- idsis- <= 0.
 
- 
isThreadContentionMonitoringSupportedboolean isThreadContentionMonitoringSupported()Tests if the Java virtual machine supports thread contention monitoring.- Returns:
- trueif the Java virtual machine supports thread contention monitoring;- falseotherwise.
 
- 
isThreadContentionMonitoringEnabledboolean isThreadContentionMonitoringEnabled()Tests if thread contention monitoring is enabled.- Returns:
- trueif thread contention monitoring is enabled;- falseotherwise.
- Throws:
- UnsupportedOperationException- if the Java virtual machine does not support thread contention monitoring.
- See Also:
 
- 
setThreadContentionMonitoringEnabledvoid setThreadContentionMonitoringEnabled(boolean enable) Enables or disables thread contention monitoring. Thread contention monitoring is disabled by default.- Parameters:
- enable-- trueto enable;- falseto disable.
- Throws:
- UnsupportedOperationException- if the Java virtual machine does not support thread contention monitoring.
- See Also:
 
- 
getCurrentThreadCpuTimelong getCurrentThreadCpuTime()Returns the total CPU time for the current thread in nanoseconds. The returned value is of nanoseconds precision but not necessarily nanoseconds accuracy. If the implementation distinguishes between user mode time and system mode time, the returned CPU time is the amount of time that the current thread has executed in user mode or system mode.This is a convenience method for local management use and is equivalent to calling: getThreadCpuTime(Thread.currentThread().threadId());- Returns:
- the total CPU time for the current thread if the current
 thread is a platform thread and if CPU time measurement is enabled;
 -1otherwise.
- Throws:
- UnsupportedOperationException- if the Java virtual machine does not support CPU time measurement for the current thread.
- See Also:
 
- 
getCurrentThreadUserTimelong getCurrentThreadUserTime()Returns the CPU time that the current thread has executed in user mode in nanoseconds. The returned value is of nanoseconds precision but not necessarily nanoseconds accuracy.This is a convenience method for local management use and is equivalent to calling: getThreadUserTime(Thread.currentThread().threadId());- Returns:
- the user-level CPU time for the current thread if the current
 thread is a platform thread and if CPU time measurement is enabled;
 -1otherwise.
- Throws:
- UnsupportedOperationException- if the Java virtual machine does not support CPU time measurement for the current thread.
- See Also:
 
- 
getThreadCpuTimelong getThreadCpuTime(long id) Returns the total CPU time for a thread of the specified ID in nanoseconds. The returned value is of nanoseconds precision but not necessarily nanoseconds accuracy. If the implementation distinguishes between user mode time and system mode time, the returned CPU time is the amount of time that the thread has executed in user mode or system mode.If the thread of the specified ID is a virtual thread, is not alive or does not exist, this method returns -1. If CPU time measurement is disabled, this method returns-1. A thread is alive if it has been started and has not yet terminated.If CPU time measurement is enabled after the thread has started, the Java virtual machine implementation may choose any time up to and including the time that the capability is enabled as the point where CPU time measurement starts. - Parameters:
- id- the thread ID of a thread
- Returns:
- the total CPU time for a thread of the specified ID if the
 thread of the specified ID is a platform thread, the thread is alive,
 and CPU time measurement is enabled;
 -1otherwise.
- Throws:
- IllegalArgumentException- if- id <= 0.
- UnsupportedOperationException- if the Java virtual machine does not support CPU time measurement for other threads.
- See Also:
 
- 
getThreadUserTimelong getThreadUserTime(long id) Returns the CPU time that a thread of the specified ID has executed in user mode in nanoseconds. The returned value is of nanoseconds precision but not necessarily nanoseconds accuracy.If the thread of the specified ID is a virtual thread, is not alive, or does not exist, this method returns -1. If CPU time measurement is disabled, this method returns-1. A thread is alive if it has been started and has not yet terminated.If CPU time measurement is enabled after the thread has started, the Java virtual machine implementation may choose any time up to and including the time that the capability is enabled as the point where CPU time measurement starts. - Parameters:
- id- the thread ID of a thread
- Returns:
- the user-level CPU time for a thread of the specified ID if the
 thread of the specified ID is a platform thread, the thread is alive,
 and CPU time measurement is enabled;
 -1otherwise.
- Throws:
- IllegalArgumentException- if- id <= 0.
- UnsupportedOperationException- if the Java virtual machine does not support CPU time measurement for other threads.
- See Also:
 
- 
isThreadCpuTimeSupportedboolean isThreadCpuTimeSupported()Tests if the Java virtual machine implementation supports CPU time measurement for any platform thread. A Java virtual machine implementation that supports CPU time measurement for any platform thread will also support CPU time measurement for the current thread, when the current thread is a platform thread.- Returns:
- trueif the Java virtual machine supports CPU time measurement for any platform thread;- falseotherwise.
 
- 
isCurrentThreadCpuTimeSupportedboolean isCurrentThreadCpuTimeSupported()Tests if the Java virtual machine supports CPU time measurement from a platform thread with thegetCurrentThreadCpuTime()andgetCurrentThreadUserTime()methods. This method returnstrueifisThreadCpuTimeSupported()returnstrue.- Returns:
- trueif the Java virtual machine supports CPU time measurement of the current platform thread;- falseotherwise.
 
- 
isThreadCpuTimeEnabledboolean isThreadCpuTimeEnabled()Tests if thread CPU time measurement is enabled.- Returns:
- trueif thread CPU time measurement is enabled;- falseotherwise.
- Throws:
- UnsupportedOperationException- if the Java virtual machine does not support CPU time measurement for other threads nor for the current thread.
- See Also:
 
- 
setThreadCpuTimeEnabledvoid setThreadCpuTimeEnabled(boolean enable) Enables or disables thread CPU time measurement. The default is platform dependent.- Parameters:
- enable-- trueto enable;- falseto disable.
- Throws:
- UnsupportedOperationException- if the Java virtual machine does not support CPU time measurement for any threads nor for the current thread.
- See Also:
 
- 
findMonitorDeadlockedThreadslong[] findMonitorDeadlockedThreads()Finds cycles of platform threads that are in deadlock waiting to acquire object monitors. That is, platform threads that are blocked waiting to enter a synchronization block or waiting to reenter a synchronization block after anObject.waitcall, where each platform thread owns one monitor while trying to obtain another monitor already held by another platform thread in a cycle. Cycles that include virtual threads are not found by this method.More formally, a thread is monitor deadlocked if it is part of a cycle in the relation "is waiting for an object monitor owned by". In the simplest case, thread A is blocked waiting for a monitor owned by thread B, and thread B is blocked waiting for a monitor owned by thread A. This method is designed for troubleshooting use, but not for synchronization control. It might be an expensive operation. This method finds deadlocks involving only object monitors. To find deadlocks involving both object monitors and ownable synchronizers, the findDeadlockedThreadsmethod should be used.- Returns:
- an array of IDs of the platform threads that are monitor
 deadlocked, if any; nullotherwise.
- See Also:
 
- 
resetPeakThreadCountvoid resetPeakThreadCount()Resets the peak thread count to the current number of live platform threads.- See Also:
 
- 
findDeadlockedThreadslong[] findDeadlockedThreads()Finds cycles of platform threads that are in deadlock waiting to acquire object monitors or ownable synchronizers. Platform threads are deadlocked in a cycle waiting for a lock of these two types if each thread owns one lock while trying to acquire another lock already held by another platform thread in the cycle. Cycles that include virtual threads are not found by this method.This method is designed for troubleshooting use, but not for synchronization control. It might be an expensive operation. - Returns:
- an array of IDs of the platform threads that are
 deadlocked waiting for object monitors or ownable synchronizers, if any;
 nullotherwise.
- Throws:
- UnsupportedOperationException- if the Java virtual machine does not support monitoring of ownable synchronizer usage.
- Since:
- 1.6
- See Also:
 
- 
isObjectMonitorUsageSupportedboolean isObjectMonitorUsageSupported()Tests if the Java virtual machine supports monitoring of object monitor usage.- Returns:
- trueif the Java virtual machine supports monitoring of object monitor usage;- falseotherwise.
- Since:
- 1.6
- See Also:
 
- 
isSynchronizerUsageSupportedboolean isSynchronizerUsageSupported()Tests if the Java virtual machine supports monitoring of ownable synchronizer usage.- Returns:
- trueif the Java virtual machine supports monitoring of ownable synchronizer usage;- falseotherwise.
- Since:
- 1.6
- See Also:
 
- 
getThreadInfoReturns the thread info for each thread whose ID is in the input arrayids, with stack trace and synchronization information. This is equivalent to calling:getThreadInfo(ids, lockedMonitors, lockedSynchronizers, Integer.MAX_VALUE)- Parameters:
- ids- an array of thread IDs.
- lockedMonitors- if- true, retrieves all locked monitors.
- lockedSynchronizers- if- true, retrieves all locked ownable synchronizers.
- Returns:
- an array of the ThreadInfoobjects, each containing information about a thread whose ID is in the corresponding element of the input array of IDs.
- Throws:
- UnsupportedOperationException-- if lockedMonitorsistruebut the Java virtual machine does not support monitoring of object monitor usage; or
- if lockedSynchronizersistruebut the Java virtual machine does not support monitoring of ownable synchronizer usage.
 
- if 
- Since:
- 1.6
- See Also:
 
- 
getThreadInfodefault ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors, boolean lockedSynchronizers, int maxDepth) Returns the thread info for each thread whose ID is in the input arrayids, with stack trace of the specified maximum number of elements and synchronization information. IfmaxDepth == 0, no stack trace of the thread will be dumped.This method obtains a snapshot of the thread information for each thread including: - stack trace of the specified maximum number of elements,
- the object monitors currently locked by the thread
        if lockedMonitorsistrue, and
- the 
        ownable synchronizers currently locked by the thread
        if lockedSynchronizersistrue.
 This method returns an array of the ThreadInfoobjects, each is the thread information about the thread with the same index as in theidsarray. If a thread of the given ID is a virtual thread, is not alive, or does not exist,nullwill be set in the corresponding element in the returned array. A thread is alive if it has been started and has not yet terminated.If a thread does not lock any object monitor or lockedMonitorsisfalse, the returnedThreadInfoobject will have an emptyMonitorInfoarray. Similarly, if a thread does not lock any synchronizer orlockedSynchronizersisfalse, the returnedThreadInfoobject will have an emptyLockInfoarray.When both lockedMonitorsandlockedSynchronizersparameters arefalse, it is equivalent to calling:getThreadInfo(ids, maxDepth)This method is designed for troubleshooting use, but not for synchronization control. It might be an expensive operation. MBeanServer access: 
 The mapped type ofThreadInfoisCompositeDatawith attributes as specified in theThreadInfo.frommethod.- Implementation Requirements:
- The default implementation throws
 UnsupportedOperationException.
- Parameters:
- ids- an array of thread IDs.
- lockedMonitors- if- true, retrieves all locked monitors.
- lockedSynchronizers- if- true, retrieves all locked ownable synchronizers.
- maxDepth- indicates the maximum number of- StackTraceElementto be retrieved from the stack trace.
- Returns:
- an array of the ThreadInfoobjects, each containing information about a thread whose ID is in the corresponding element of the input array of IDs.
- Throws:
- IllegalArgumentException- if- maxDepthis negative.
- UnsupportedOperationException-- if lockedMonitorsistruebut the Java virtual machine does not support monitoring of object monitor usage; or
- if lockedSynchronizersistruebut the Java virtual machine does not support monitoring of ownable synchronizer usage.
 
- if 
- Since:
- 10
- See Also:
 
- 
dumpAllThreadsReturns the thread info for all live platform threads with stack trace and synchronization information. The thread IDs of virtual threads are not included. This method is equivalent to calling:dumpAllThreads(lockedMonitors, lockedSynchronizers, Integer.MAX_VALUE)- Parameters:
- lockedMonitors- if- true, dump all locked monitors.
- lockedSynchronizers- if- true, dump all locked ownable synchronizers.
- Returns:
- an array of ThreadInfofor all live platform threads.
- Throws:
- UnsupportedOperationException-- if lockedMonitorsistruebut the Java virtual machine does not support monitoring of object monitor usage; or
- if lockedSynchronizersistruebut the Java virtual machine does not support monitoring of ownable synchronizer usage.
 
- if 
- Since:
- 1.6
- See Also:
 
- 
dumpAllThreadsdefault ThreadInfo[] dumpAllThreads(boolean lockedMonitors, boolean lockedSynchronizers, int maxDepth) Returns the thread info for all live platform threads with stack trace of the specified maximum number of elements and synchronization information. ifmaxDepth == 0, no stack trace of the thread will be dumped. The thread IDs of virtual threads are not included. Some threads included in the returned array may have been terminated when this method returns.This method returns an array of ThreadInfoobjects as specified in thegetThreadInfo(long[], boolean, boolean, int)method.- Implementation Requirements:
- The default implementation throws
 UnsupportedOperationException.
- Parameters:
- lockedMonitors- if- true, dump all locked monitors.
- lockedSynchronizers- if- true, dump all locked ownable synchronizers.
- maxDepth- indicates the maximum number of- StackTraceElementto be retrieved from the stack trace.
- Returns:
- an array of ThreadInfofor all live platform threads.
- Throws:
- IllegalArgumentException- if- maxDepthis negative.
- UnsupportedOperationException-- if lockedMonitorsistruebut the Java virtual machine does not support monitoring of object monitor usage; or
- if lockedSynchronizersistruebut the Java virtual machine does not support monitoring of ownable synchronizer usage.
 
- if 
- Since:
- 10
- See Also:
 
 
-