Path: blob/master/jcl/src/java.management/share/classes/java/lang/management/ThreadMXBean.java
12511 views
/*[INCLUDE-IF JAVA_SPEC_VERSION >= 8]*/1/*2*******************************************************************************3* Copyright (c) 2005, 2022 IBM Corp. and others4*5* This program and the accompanying materials are made available under6* the terms of the Eclipse Public License 2.0 which accompanies this7* distribution and is available at https://www.eclipse.org/legal/epl-2.0/8* or the Apache License, Version 2.0 which accompanies this distribution and9* is available at https://www.apache.org/licenses/LICENSE-2.0.10*11* This Source Code may also be made available under the following12* Secondary Licenses when the conditions for such availability set13* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU14* General Public License, version 2 with the GNU Classpath15* Exception [1] and GNU General Public License, version 2 with the16* OpenJDK Assembly Exception [2].17*18* [1] https://www.gnu.org/software/classpath/license.html19* [2] http://openjdk.java.net/legal/assembly-exception.html20*21* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception22*******************************************************************************/23package java.lang.management;2425/**26* The management and monitoring interface for the threading system of the27* virtual machine.28* <p>29* Precisely one instance of this interface will be made available to management30* clients.31* </p>32* <p>33* Accessing this <code>MXBean</code> can be done in one of three ways.34* <ol>35* <li>Invoking the static {@link ManagementFactory#getThreadMXBean} method.36* </li>37* <li>Using a javax.management.MBeanServerConnection.</li>38* <li>Obtaining a proxy MXBean from the static39* {@link ManagementFactory#newPlatformMXBeanProxy} method, passing in40* "java.lang:type=Threading" for the value of the second parameter.41* </li>42* </ol>43*44* @since 1.545*/46public interface ThreadMXBean extends PlatformManagedObject {4748/**49* Returns the thread identifiers of every thread in this virtual machine50* that is currently blocked in a deadlock situation over a monitor object.51* A thread is considered to be deadlocked if it is blocked waiting to run52* and owns an object monitor that is sought by another blocked thread. Two53* or more threads can be in a deadlock cycle. To determine the threads54* currently deadlocked by object monitors <i>and</i> ownable synchronizers55* use the {@link #findDeadlockedThreads()} method.56* <p>57* It is recommended that this method be used solely for problem58* determination analysis and not as a means of managing thread59* synchronization in a virtual machine. This is because the method may be60* very expensive to run.61* </p>62*63* @return an array of the identifiers of every thread in the virtual64* machine that has been detected as currently being in a deadlock65* situation over an object monitor. May be <code>null</code> if66* there are currently no threads in that category.67* @throws SecurityException68* if there is a security manager in effect and the caller does69* not have {@link ManagementPermission} of "monitor".70*/71public long[] findMonitorDeadlockedThreads();7273/**74* Returns an array of the identifiers of all of the threads that are alive75* in the current virtual machine. When processing the return from this76* method it should <i>not </i> be assumed that each identified thread is77* still alive.78*79* @return the identifiers of all of the threads currently alive in the80* virtual machine.81*/82public long[] getAllThreadIds();8384/**85* If supported by the virtual machine, returns the total CPU usage time for86* the currently running thread. The returned time will have nanosecond87* precision but may not have nanosecond accuracy.88* <p>89* Method {@link #isCurrentThreadCpuTimeSupported()} may be used to90* determine if current thread CPU timing is supported on the virtual91* machine. On virtual machines where current thread CPU timing is92* supported, the method {@link #isThreadCpuTimeEnabled()} may be used to93* determine if thread CPU timing is actually enabled.94* </p>95* <p>96* The return value is identical to that which would be obtained by calling97* {@link #getThreadCpuTime} with an argument98* <code>Thread.currentThread().getId())</code>.99* </p>100*101* @return on virtual machines where current thread CPU timing is supported102* and thread CPU timing is enabled, the number of nanoseconds CPU103* usage by the current thread. On virtual machines where current104* thread CPU timing is supported but thread CPU timing is not105* enabled, <code>-1</code>.106* @throws UnsupportedOperationException107* if the virtual machine does not support current thread CPU108* timing.109*110*/111public long getCurrentThreadCpuTime();112113/**114* If supported by the virtual machine, returns the total CPU usage time for115* the current thread running in user mode. The returned time will have116* nanosecond precision but may not have nanosecond accuracy.117* <p>118* Method {@link #isCurrentThreadCpuTimeSupported()} may be used to119* determine if current thread CPU timing is supported on the virtual120* machine. On virtual machines where current thread CPU timing is121* supported, the method {@link #isThreadCpuTimeEnabled()} may be used to122* determine if thread CPU timing is actually enabled.123* </p>124* <p>125* The return value is identical to that which would be obtained by calling126* {@link #getThreadUserTime} with an argument127* <code>Thread.currentThread().getId())</code>.128* </p>129*130* @return on virtual machines where current thread CPU timing is supported131* and thread CPU timing is enabled, the number of nanoseconds CPU132* time used by the current thread running in user mode. On virtual133* machines where current thread CPU timing is supported but thread134* CPU timing is not enabled, <code>-1</code>.135* @throws UnsupportedOperationException136* if the virtual machine does not support current thread CPU137* timing.138*139*/140public long getCurrentThreadUserTime();141142/**143* Returns the number of daemon threads currently alive in the virtual144* machine.145*146* @return the number of currently alive daemon threads.147*/148public int getDaemonThreadCount();149150/**151* Returns the peak number of threads that have ever been alive in the152* virtual machine at any one instant since either the virtual machine153* start-up or the peak was reset.154*155* @return the peak number of live threads156* @see #resetPeakThreadCount()157*/158public int getPeakThreadCount();159160/**161* Returns the number of threads currently alive in the virtual machine.162* This includes both daemon threads and non-daemon threads.163*164* @return the number of currently alive threads.165*/166public int getThreadCount();167168/**169* If supported by the virtual machine, returns the total CPU usage time for170* the thread with the specified identifier. The returned time will have171* nanosecond precision but may not have nanosecond accuracy.172* <p>173* Method {@link #isThreadCpuTimeSupported()} may be used to determine if174* the CPU timing of threads is supported on the virtual machine. On virtual175* machines where current thread CPU timing is supported, the method176* {@link #isThreadCpuTimeEnabled()} may be used to determine if thread CPU177* timing is actually enabled.178* </p>179*180* @param id181* the identifier for a thread. Must be a positive number greater182* than zero.183* @return on virtual machines where thread CPU timing is supported and184* enabled, and there is a living thread with identifier185* <code>id</code>, the number of nanoseconds CPU time used by186* the thread. On virtual machines where thread CPU timing is187* supported but not enabled, or where there is no living thread188* with identifier <code>id</code> present in the virtual machine,189* a value of <code>-1</code> is returned.190* @throws IllegalArgumentException191* if <code>id</code> is <=0.192* @throws UnsupportedOperationException193* if the virtual machine does not support thread CPU timing.194* @see #isThreadCpuTimeSupported()195* @see #isThreadCpuTimeEnabled()196*/197public long getThreadCpuTime(long id);198199/**200* Returns a {@link ThreadInfo} object for the thread with the specified201* identifier. The returned object will not have a stack trace so that a202* call to its <code>getStackTrace()</code> method will result in an empty203* <code>StackTraceElement</code> array. Similarly, the returned object204* will hold no details of locked synchronizers or locked object monitors205* for the specified thread; calls to <code>getLockedMonitors()</code> and206* <code>getLockedSynchronizers</code> will both return array values.207*208* @param id209* the identifier for a thread. Must be a positive number greater210* than zero.211* @return if the supplied <code>id</code> maps to a living thread in the212* virtual machine (i.e. a started thread which has not yet died),213* this method returns a {@link ThreadInfo} object corresponding to214* that thread. Otherwise, returns <code>null</code>.215* @throws IllegalArgumentException216* if <code>id</code> is <=0.217* @throws SecurityException218* if there is a security manager in effect and the caller does219* not have {@link ManagementPermission} of "monitor".220*/221public ThreadInfo getThreadInfo(long id);222223/**224* Returns an array of {@link ThreadInfo} objects ; one for each of the225* threads specified in the input array of identifiers. None of the objects226* in the return array will have a stack trace so that a call to its227* <code>getStackTrace()</code> method will result in an empty228* <code>StackTraceElement</code> array. Similarly, the returned object229* will hold no details of locked synchronizers or locked object monitors230* for the specified thread; calls to <code>getLockedMonitors()</code> and231* <code>getLockedSynchronizers</code> will both return array values.232*233* @param ids234* an array of thread identifiers. Each one must be a positive235* number greater than zero.236* @return an array of {@link ThreadInfo} objects with each entry237* corresponding to one of the threads specified in the input array238* of identifiers. The return array will therefore have an identical239* number of elements to the input <code>ids</code> array. If an240* entry in the <code>ids</code> array is invalid (there is no241* living thread with the supplied identifier in the virtual242* machine) then the corresponding entry in the return array will be243* a <code>null</code>.244* @throws IllegalArgumentException245* if any of the entries in the <code>ids</code> array is246* <=0.247* @throws SecurityException248* if there is a security manager in effect and the caller does249* not have {@link ManagementPermission} of "monitor".250*/251public ThreadInfo[] getThreadInfo(long[] ids);252253/**254* Returns an array of {@link ThreadInfo} objects ; one for each of the255* threads specified in the <code>ids</code> argument. The stack trace256* information in the returned objects will depend on the value of the257* <code>maxDepth</code> argument which specifies the maximum number of258* {@link StackTraceElement} instances to try and include. A subsequent call259* to any of the returned objects' <code>getStackTrace()</code> method260* should result in a {@link StackTraceElement} array of up to261* <code>maxDepth</code> elements. A <code>maxDepth</code> value of262* <code>Integer.MAX_VALUE</code> will attempt to obtain all of the stack263* trace information for each specified thread while a <code>maxDepth</code>264* value of zero will yield none.265* <p>266* The returned object will hold no details of locked synchronizers or267* locked object monitors for the specified thread; calls to268* <code>getLockedMonitors()</code> and269* <code>getLockedSynchronizers</code> will both return array values.270* </p>271*272* @param ids273* an array of thread identifiers. Each must be a positive number274* greater than zero.275* @param maxDepth276* the <i>maximum </i> number of stack trace entries to be277* included in each of the returned <code>ThreadInfo</code>278* objects. Supplying <code>Integer.MAX_VALUE</code> attempts279* to obtain all of the stack traces. Only a positive value is280* expected.281* @return an array of <code>ThreadInfo</code> objects. The size of the282* array will be identical to that of the <code>ids</code>283* argument. Null elements will be placed in the array if the284* corresponding thread identifier in <code>ids</code> does not285* resolve to a living thread in the virtual machine (i.e. a started286* thread which has not yet died).287* @throws IllegalArgumentException288* if any element in <code>ids</code> is <=0.289* @throws IllegalArgumentException290* if <code>maxDepth</code> is <0.291* @throws SecurityException292* if there is a security manager in effect and the caller does293* not have {@link ManagementPermission} of "monitor".294*/295public ThreadInfo[] getThreadInfo(long[] ids, int maxDepth);296297/**298* Returns an array of {@link ThreadInfo} objects; one for each of the299* threads specified in the <code>ids</code> argument. Each300* <code>ThreadInfo</code> will hold details of all of the stack trace301* information for each specified thread. The returned302* <code>ThreadInfo</code> objects will optionally contain details of all303* monitor objects and synchronizers locked by the corresponding thread. In304* order to retrieve locked monitor information the305* <code>lockedMonitors</code> argument should be set to <code>true</code>;306* in order to retrieve locked synchronizers information307* <code>lockedSynchronizers</code> should be set to <code>true</code>.308* For a given <code>ThreadInfo</code> element of the return array the309* optional information may be inspected by calling310* {@link ThreadInfo#getLockedMonitors()} and311* {@link ThreadInfo#getLockedSynchronizers()} respectively.312* <p>313* Both <code>lockedMonitors</code> and <code>lockedSynchronizers</code>314* arguments should only be set to <code>true</code> if the virtual315* machine supports the requested monitoring.316* </p>317*318* @param ids319* an array of thread identifiers. Each one must be a positive320* number greater than zero.321* @param lockedMonitors322* boolean indication of whether or not each returned323* <code>ThreadInfo</code> should hold information on locked324* object monitors325* @param lockedSynchronizers326* boolean indication of whether or not each returned327* <code>ThreadInfo</code> should hold information on locked328* synchronizers329* @return an array of {@link ThreadInfo} objects with each entry330* corresponding to one of the threads specified in the input array331* of identifiers. The return array will therefore have an identical332* number of elements to the input <code>ids</code> array. If an333* entry in the <code>ids</code> array is invalid (there is no334* living thread with the supplied identifier in the virtual335* machine) then the corresponding entry in the return array will be336* a <code>null</code>.337* @throws IllegalArgumentException338* if any of the entries in the <code>ids</code> array is339* <=0.340* @throws SecurityException341* if there is a security manager in effect and the caller does342* not have {@link ManagementPermission} of "monitor".343* @throws UnsupportedOperationException344* if either of the following conditions apply:345* <ul>346* <li><code>lockedMonitors</code> is <code>true</code> but347* a call to {@link #isObjectMonitorUsageSupported()} would348* result in a <code>false</code> value349* <li><code>lockedSynchronizers</code> is <code>true</code>350* but a call to {@link #isSynchronizerUsageSupported()} would351* result in a <code>false</code> value352* </ul>353*/354public ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors,355boolean lockedSynchronizers);356357/**358* Returns a {@link ThreadInfo} object for the thread with the specified359* identifier. The stack trace information in the returned object will360* depend on the value of the <code>maxDepth</code> argument which361* specifies the maximum number of {@link StackTraceElement} instances to362* include. A subsequent call to the returned object's363* <code>getStackTrace()</code> method should then result in a364* {@link StackTraceElement} array of up to <code>maxDepth</code>365* elements. A <code>maxDepth</code> value of366* <code>Integer.MAX_VALUE</code> will obtain all of the stack trace367* information for the thread while a <code>maxDepth</code> value of zero368* will yield none.369* <p>370* It is possible that the virtual machine may be unable to supply any stack371* trace information for the specified thread. In that case the returned372* <code>ThreadInfo</code> object will have an empty array of373* <code>StackTraceElement</code>s.374* </p>375* <p>376* The returned object will hold no details of locked synchronizers or377* locked object monitors for the specified thread; calls to378* <code>getLockedMonitors()</code> and379* <code>getLockedSynchronizers</code> will both return array values.380* </p>381*382* @param id383* the identifier for a thread. Must be a positive number greater384* than zero.385* @param maxDepth386* the <i>maximum </i> number of stack trace entries to be387* included in the returned <code>ThreadInfo</code> object.388* Supplying <code>Integer.MAX_VALUE</code> obtains all of the389* stack trace. Only a positive value is expected.390* @return if the supplied <code>id</code> maps to a living thread in the391* virtual machine (i.e. a started thread which has not yet died),392* this method returns a {@link ThreadInfo} object corresponding to393* that thread. Otherwise, returns <code>null</code>.394* @throws IllegalArgumentException395* if <code>id</code> is <=0.396* @throws IllegalArgumentException397* if <code>maxDepth</code> is <0.398* @throws SecurityException399* if there is a security manager in effect and the caller does400* not have {@link ManagementPermission} of "monitor".401*/402public ThreadInfo getThreadInfo(long id, int maxDepth);403404/**405* If supported by the virtual machine, returns the total CPU usage time for406* the thread with the specified identifier when running in user mode. The407* returned time will have nanosecond precision but may not have nanosecond408* accuracy.409* <p>410* Method {@link #isThreadCpuTimeSupported()} may be used to determine if411* the CPU timing of threads is supported on the virtual machine. On virtual412* machines where current thread CPU timing is supported, the method413* {@link #isThreadCpuTimeEnabled()} may be used to determine if thread CPU414* timing is actually enabled.415* </p>416*417* @param id418* the identifier for a thread. Must be a positive number greater419* than zero.420* @return on virtual machines where thread CPU timing is supported and421* enabled, and there is a living thread with identifier422* <code>id</code>, the number of nanoseconds CPU time used by423* the thread running in user mode. On virtual machines where thread424* CPU timing is supported but not enabled, or where there is no425* living thread with identifier <code>id</code> present in the426* virtual machine, a value of <code>-1</code> is returned.427* <p>428* If thread CPU timing was disabled when the thread was started429* then the virtual machine is free to choose any measurement start430* time between when the virtual machine started up and when thread431* CPU timing was enabled with a call to432* {@link #setThreadCpuTimeEnabled(boolean)}.433* </p>434* @throws IllegalArgumentException435* if <code>id</code> is <=0.436* @throws UnsupportedOperationException437* if the virtual machine does not support thread CPU timing.438* @see #isThreadCpuTimeSupported()439* @see #isThreadCpuTimeEnabled()440*/441public long getThreadUserTime(long id);442443/**444* Returns the number of threads that have been started in this virtual445* machine since it came into being.446*447* @return the total number of started threads.448*/449public long getTotalStartedThreadCount();450451/**452* Returns a boolean indication of whether or not the virtual machine453* supports the CPU timing of the current thread.454* <p>455* Note that this method must return <code>true</code> if456* {@link #isThreadCpuTimeSupported()} returns <code>true</code>.457* </p>458*459* @return <code>true</code> if CPU timing of the current thread is460* supported, otherwise <code>false</code>.461*/462public boolean isCurrentThreadCpuTimeSupported();463464/**465* Returns a boolean indication of whether or not the monitoring of thread466* contention situations is enabled on this virtual machine.467*468* @return <code>true</code> if thread contention monitoring is enabled,469* <code>false</code> otherwise.470*/471public boolean isThreadContentionMonitoringEnabled();472473/**474* Returns a boolean indication of whether or not the monitoring of thread475* contention situations is supported on this virtual machine.476*477* @return <code>true</code> if thread contention monitoring is supported,478* <code>false</code> otherwise.479*/480public boolean isThreadContentionMonitoringSupported();481482/**483* Returns a boolean indication of whether or not the CPU timing of threads484* is enabled on this virtual machine.485*486* @return <code>true</code> if thread CPU timing is enabled,487* <code>false</code> otherwise.488* @throws UnsupportedOperationException489* if the virtual machine does not support thread CPU timing.490* @see #isThreadCpuTimeSupported()491*/492public boolean isThreadCpuTimeEnabled();493494/**495* Returns a boolean indication of whether or not the virtual machine496* supports the CPU time measurement of any threads (current or otherwise).497*498* @return <code>true</code> if the virtual machine supports the CPU499* timing of threads, <code>false</code> otherwise.500*/501public boolean isThreadCpuTimeSupported();502503/**504* Resets the peak thread count to be the current number of threads alive in505* the virtual machine when the call is made.506*507* @throws SecurityException508* if there is a security manager in effect and the caller does509* not have {@link ManagementPermission} of "control".510*/511public void resetPeakThreadCount();512513/**514* Updates the virtual machine to either enable or disable the monitoring of515* thread contention situations.516* <p>517* If it is supported, the virtual machine will initially not monitor thread518* contention situations.519* </p>520*521* @param enable522* enable thread contention monitoring if <code>true</code>,523* otherwise disable thread contention monitoring.524* @throws SecurityException525* if there is a security manager in effect and the caller does526* not have {@link ManagementPermission} of "control".527* @throws UnsupportedOperationException528* if the virtual machine does not support thread contention529* monitoring.530* @see #isThreadContentionMonitoringSupported()531*/532public void setThreadContentionMonitoringEnabled(boolean enable);533534/**535* If supported, updates the virtual machine to either enable or disable the536* CPU timing of threads.537* <p>538* The default value of this property depends on the underlying operating539* system on which the virtual machine is running.540* </p>541*542* @param enable543* enable thread CPU timing if <code>true</code>, otherwise544* disable thread CPU timing545* @throws SecurityException546* if there is a security manager in effect and the caller does547* not have {@link ManagementPermission} of "control".548* @throws UnsupportedOperationException549* if the virtual machine does not support thread CPU timing.550* @see #isThreadCpuTimeSupported()551*/552public void setThreadCpuTimeEnabled(boolean enable);553554/**555* Returns a boolean indication of whether or not the virtual machine556* supports the monitoring of object monitor usage.557*558* @return <code>true</code> if object monitor usage is permitted,559* otherwise <code>false</code>560* @since 1.6561*/562public boolean isObjectMonitorUsageSupported();563564/**565* Returns a boolean indication of whether or not the virtual machine566* supports the monitoring of ownable synchronizers (synchronizers that make567* use of the <code>AbstractOwnableSynchronizer</code> type and which are568* completely owned by a single thread).569*570* @return <code>true</code> if synchronizer usage monitoring is571* permitted, otherwise <code>false</code>572*/573public boolean isSynchronizerUsageSupported();574575/**576* If supported by the virtual machine, this method can be used to retrieve577* the <code>long</code> id of all threads currently waiting on object578* monitors or ownable synchronizers (synchronizers that make use of the579* <code>AbstractOwnableSynchronizer</code> type and which are completely580* owned by a single thread). To determine the threads currently deadlocked581* by object monitors only use the {@link #findMonitorDeadlockedThreads()}582* method.583* <p>584* It is recommended that this method be used solely for problem585* determination analysis and not as a means of managing thread586* synchronization in a virtual machine. This is because the method may be587* very expensive to run.588* </p>589*590* @return an array of the identifiers of every thread in the virtual591* machine that has been detected as currently being in a deadlock592* situation involving object monitors <i>and</i> ownable593* synchronizers. If there are no threads in this category a594* <code>null</code> is returned.595* @throws SecurityException596* if there is a security manager in effect and the caller does597* not have {@link ManagementPermission} of "monitor".598* @throws UnsupportedOperationException599* if the virtual machine does not support any monitoring of600* ownable synchronizers.601* @see #isSynchronizerUsageSupported()602*603*/604public long[] findDeadlockedThreads();605606/**607* Returns an array of {@link ThreadInfo} objects holding information on all608* threads that were alive when the call was invoked.609*610* @param lockedMonitors611* boolean indication of whether or not information on all612* currently locked object monitors is to be included in the613* returned array614* @param lockedSynchronizers615* boolean indication of whether or not information on all616* currently locked ownable synchronizers is to be included in617* the returned array618* @return an array of <code>ThreadInfo</code> objects619* @throws SecurityException620* if there is a security manager in effect and the caller does621* not have {@link ManagementPermission} of "monitor".622* @throws UnsupportedOperationException623* if either of the following conditions apply:624* <ul>625* <li><code>lockedMonitors</code> is <code>true</code> but626* a call to {@link #isObjectMonitorUsageSupported()} would627* result in a <code>false</code> value628* <li><code>lockedSynchronizers</code> is <code>true</code>629* but a call to {@link #isSynchronizerUsageSupported()} would630* result in a <code>false</code> value631* </ul>632*/633public ThreadInfo[] dumpAllThreads(boolean lockedMonitors,634boolean lockedSynchronizers);635636/*[IF JAVA_SPEC_VERSION >= 10]*/637/**638* Returns an array of {@link ThreadInfo} objects holding information on all639* threads that were alive when the call was invoked.640*641* @param lockedMonitors642* boolean indication of whether or not information on all643* currently locked object monitors is to be included in the644* returned array645* @param lockedSynchronizers646* boolean indication of whether or not information on all647* currently locked ownable synchronizers is to be included in648* the returned array649* @param maxDepth limits the number of stack frames returned650* @return an array of <code>ThreadInfo</code> objects651* @throws SecurityException652* if there is a security manager in effect and the caller does653* not have {@link ManagementPermission} of "monitor".654* @throws UnsupportedOperationException655* if either of the following conditions apply:656* <ul>657* <li><code>lockedMonitors</code> is <code>true</code> but658* a call to {@link #isObjectMonitorUsageSupported()} would659* result in a <code>false</code> value</li>660* <li><code>lockedSynchronizers</code> is <code>true</code>661* but a call to {@link #isSynchronizerUsageSupported()} would662* result in a <code>false</code> value</li>663* </ul>664* @since 10665*/666public default ThreadInfo[] dumpAllThreads(667boolean lockedMonitors, boolean lockedSynchronizers, int maxDepth668) {669throw new UnsupportedOperationException();670}671672/**673* Returns an array of {@link ThreadInfo} objects; one for each of the674* threads specified in the <code>ids</code> argument. Each675* <code>ThreadInfo</code> will hold details of all of the stack trace676* information for each specified thread. The returned677* <code>ThreadInfo</code> objects will optionally contain details of all678* monitor objects and synchronizers locked by the corresponding thread. In679* order to retrieve locked monitor information the680* <code>lockedMonitors</code> argument should be set to <code>true</code>;681* in order to retrieve locked synchronizers information682* <code>lockedSynchronizers</code> should be set to <code>true</code>.683* For a given <code>ThreadInfo</code> element of the return array the684* optional information may be inspected by calling685* {@link ThreadInfo#getLockedMonitors()} and686* {@link ThreadInfo#getLockedSynchronizers()} respectively.687* <p>688* Both <code>lockedMonitors</code> and <code>lockedSynchronizers</code>689* arguments should only be set to <code>true</code> if the virtual690* machine supports the requested monitoring.691* </p>692*693* @param ids694* an array of thread identifiers. Each one must be a positive695* number greater than zero.696* @param lockedMonitors697* boolean indication of whether or not each returned698* <code>ThreadInfo</code> should hold information on locked699* object monitors700* @param lockedSynchronizers701* boolean indication of whether or not each returned702* <code>ThreadInfo</code> should hold information on locked703* synchronizers704* @param maxDepth limits the number of stack frames returned705* @return an array of {@link ThreadInfo} objects with each entry706* corresponding to one of the threads specified in the input array707* of identifiers. The return array will therefore have an identical708* number of elements to the input <code>ids</code> array. If an709* entry in the <code>ids</code> array is invalid (there is no710* living thread with the supplied identifier in the virtual711* machine) then the corresponding entry in the return array will be712* a <code>null</code>.713* @throws IllegalArgumentException714* if any of the entries in the <code>ids</code> array is715* <=0.716* @throws SecurityException717* if there is a security manager in effect and the caller does718* not have {@link ManagementPermission} of "monitor".719* @throws UnsupportedOperationException720* if either of the following conditions apply:721* <ul>722* <li><code>lockedMonitors</code> is <code>true</code> but723* a call to {@link #isObjectMonitorUsageSupported()} would724* result in a <code>false</code> value</li>725* <li><code>lockedSynchronizers</code> is <code>true</code>726* but a call to {@link #isSynchronizerUsageSupported()} would727* result in a <code>false</code> value</li>728* </ul>729* @since 10730*/731public default ThreadInfo[] getThreadInfo(732long[] ids, boolean lockedMonitors, boolean lockedSynchronizers, int maxDepth733) {734throw new UnsupportedOperationException();735}736/*[ENDIF] JAVA_SPEC_VERSION >= 10 */737}738739740