Interface ThreadMXBean
- All Superinterfaces:
PlatformManagedObject, ThreadMXBean, ThreadMXBean
The OpenJ9 extension interface to
ThreadMXBean. It publishes
APIs specific to com.ibm.lang.management, exposing additional
information than what the standard ThreadMXBean does.-
Method Summary
Modifier and TypeMethodDescriptiondumpAllExtendedThreads(boolean lockedMonitors, boolean lockedSynchronizers) API method that fetches an array of ExtendedThreadInfo objects corresponding to threads in the virtual machine during the time it is invoked.longgetNativeThreadId(long threadId) Find the native (operating system assigned) thread identifiers corresponding to a unique TID (as returned by java/lang/Thread.getId()).long[]getNativeThreadIds(long[] threadIDs) Fetches an array of the native (operating system assigned) identifiers corresponding to unique TIDs (as returned by java/lang/Thread.getId()) specified to it.Methods declared in interface PlatformManagedObject
getObjectNameModifier and TypeMethodDescriptionReturns anObjectNameinstance representing the object name of this platform managed object.Methods declared in interface ThreadMXBean
getCurrentThreadAllocatedBytes, getThreadAllocatedBytes, getThreadAllocatedBytes, getThreadCpuTime, getThreadUserTime, getTotalThreadAllocatedBytes, isThreadAllocatedMemoryEnabled, isThreadAllocatedMemorySupported, setThreadAllocatedMemoryEnabledModifier and TypeMethodDescriptiondefault longReturns an approximation of the total amount of memory, in bytes, allocated in heap memory for the current thread.longgetThreadAllocatedBytes(long id) Returns an approximation of the total amount of memory, in bytes, allocated in heap memory for the thread with the specified ID.long[]getThreadAllocatedBytes(long[] ids) Returns an approximation of the total amount of memory, in bytes, allocated in heap memory for each thread whose ID is in the input arrayids.long[]getThreadCpuTime(long[] ids) Returns the total CPU time for each thread whose ID is in the input arrayidsin nanoseconds.long[]getThreadUserTime(long[] ids) Returns the CPU time that each thread whose ID is in the input arrayidshas executed in user mode in nanoseconds.default longReturns an approximation of the total amount of memory, in bytes, allocated in heap memory by all threads since the Java virtual machine started.booleanTests if thread memory allocation measurement is enabled.booleanTests if the Java virtual machine implementation supports thread memory allocation measurement.voidsetThreadAllocatedMemoryEnabled(boolean enable) Enables or disables thread memory allocation measurement.Methods declared in interface ThreadMXBean
dumpAllThreads, dumpAllThreads, findDeadlockedThreads, findMonitorDeadlockedThreads, getAllThreadIds, getCurrentThreadCpuTime, getCurrentThreadUserTime, getDaemonThreadCount, getPeakThreadCount, getThreadCount, getThreadCpuTime, getThreadInfo, getThreadInfo, getThreadInfo, getThreadInfo, getThreadInfo, getThreadInfo, getThreadUserTime, getTotalStartedThreadCount, isCurrentThreadCpuTimeSupported, isObjectMonitorUsageSupported, isSynchronizerUsageSupported, isThreadContentionMonitoringEnabled, isThreadContentionMonitoringSupported, isThreadCpuTimeEnabled, isThreadCpuTimeSupported, resetPeakThreadCount, setThreadContentionMonitoringEnabled, setThreadCpuTimeEnabledModifier 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. ifmaxDepth == 0, no stack trace of the thread will be dumped.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 theThreadMXBean.getCurrentThreadCpuTime()andThreadMXBean.getCurrentThreadUserTime()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.
-
Method Details
-
getNativeThreadIds
Fetches an array of the native (operating system assigned) identifiers corresponding to unique TIDs (as returned by java/lang/Thread.getId()) specified to it.- Parameters:
threadIDs- An array of thread identifiers that the user wishes to obtain native thread identifiers for.- Returns:
- An array of operating system assigned native thread identifiers. If a thread among the given set of IDs is no longer alive or does not exist, a -1 is set in the corresponding element of the returned array.
- Throws:
IllegalArgumentException- is thrown if any of the thread identifiers passed is invalid (<=0).
-
getNativeThreadId
Find the native (operating system assigned) thread identifiers corresponding to a unique TID (as returned by java/lang/Thread.getId()). When querying multiple threadIDs, consider using getNativeThreadIds(long[]) as it is more efficient than getNativeThreadId().- Parameters:
threadId- The Java runtime allocated thread identifier.- Returns:
- Operating system assigned native thread identifier. If the thread corresponding to the ID is no longer alive or does not exist, -1 is returned.
- Throws:
IllegalArgumentException- is thrown if the thread identifier passed is invalid (<=0).
-
dumpAllExtendedThreads
ExtendedThreadInfo[] dumpAllExtendedThreads(boolean lockedMonitors, boolean lockedSynchronizers) throws InternalError, UnsupportedOperationException API method that fetches an array of ExtendedThreadInfo objects corresponding to threads in the virtual machine during the time it is invoked. Fetches an array of ExtendedThreadInfo objects that provide native thread identifiers along with java.lang.management.ThreadInfo object representing the thread. Consider using dumpAllExtendedThreads() in place of dumpAllThreads() as it provides additional thread identification information in an efficient manner.- Parameters:
lockedMonitors- boolean indication of whether or not information on all currently locked object monitors is to be included in the returned arraylockedSynchronizers- boolean indication of whether or not information on all currently locked ownable synchronizers is to be included in the returned array- Returns:
- Array of ExtendedThreadInfo objects.
- Throws:
UnsupportedOperationException- is thrown if the JVM does not support monitoring object monitor usage or ownable synchronizer usage, even as it has been specified.InternalError- is thrown in case an error occurs while fetching thread information, typically, an internal error resulting from an inconsistency in the class library.
-