declare namespace java { namespace lang { namespace management { /** * The management and monitoring interface for the threading system of the * virtual machine. *
* Precisely one instance of this interface will be made available to management * clients. *
*
* Accessing this MXBean
can be done in one of three ways.
*
* It is recommended that this method be used solely for problem * determination analysis and not as a means of managing thread * synchronization in a virtual machine. This is because the method may be * very expensive to run. *
* @return an array of the identifiers of every thread in the virtual * machine that has been detected as currently being in a deadlock * situation over an object monitor. May benull
if
* there are currently no threads in that category.
* @throws SecurityException
* if there is a security manager in effect and the caller does
* not have {#link ManagementPermission} of "monitor".
*/
// @ts-ignore
findMonitorDeadlockedThreads(): number /*long*/[]
/**
* Returns an array of the identifiers of all of the threads that are alive
* in the current virtual machine. When processing the return from this
* method it should not be assumed that each identified thread is
* still alive.
* @return the identifiers of all of the threads currently alive in the
* virtual machine.
*/
// @ts-ignore
getAllThreadIds(): number /*long*/[]
/**
* If supported by the virtual machine, returns the total CPU usage time for
* the currently running thread. The returned time will have nanosecond
* precision but may not have nanosecond accuracy.
* * Method {@link #isCurrentThreadCpuTimeSupported()} may be used to * determine if current thread CPU timing is supported on the virtual * machine. On virtual machines where current thread CPU timing is * supported, the method {@link #isThreadCpuTimeEnabled()} may be used to * determine if thread CPU timing is actually enabled. *
*
* The return value is identical to that which would be obtained by calling
* {@link #getThreadCpuTime} with an argument
* Thread.currentThread().getId())
.
*
-1
.
* @throws UnsupportedOperationException
* if the virtual machine does not support current thread CPU
* timing.
*/
// @ts-ignore
getCurrentThreadCpuTime(): number /*long*/
/**
* If supported by the virtual machine, returns the total CPU usage time for
* the current thread running in user mode. The returned time will have
* nanosecond precision but may not have nanosecond accuracy.
* * Method {@link #isCurrentThreadCpuTimeSupported()} may be used to * determine if current thread CPU timing is supported on the virtual * machine. On virtual machines where current thread CPU timing is * supported, the method {@link #isThreadCpuTimeEnabled()} may be used to * determine if thread CPU timing is actually enabled. *
*
* The return value is identical to that which would be obtained by calling
* {@link #getThreadUserTime} with an argument
* Thread.currentThread().getId())
.
*
-1
.
* @throws UnsupportedOperationException
* if the virtual machine does not support current thread CPU
* timing.
*/
// @ts-ignore
getCurrentThreadUserTime(): number /*long*/
/**
* Returns the number of daemon threads currently alive in the virtual
* machine.
* @return the number of currently alive daemon threads.
*/
// @ts-ignore
getDaemonThreadCount(): number /*int*/
/**
* Returns the peak number of threads that have ever been alive in the
* virtual machine at any one instant since either the virtual machine
* start-up or the peak was reset.
* @return the peak number of live threads
* @see #resetPeakThreadCount()
*/
// @ts-ignore
getPeakThreadCount(): number /*int*/
/**
* Returns the number of threads currently alive in the virtual machine.
* This includes both daemon threads and non-daemon threads.
* @return the number of currently alive threads.
*/
// @ts-ignore
getThreadCount(): number /*int*/
/**
* If supported by the virtual machine, returns the total CPU usage time for
* the thread with the specified identifier. The returned time will have
* nanosecond precision but may not have nanosecond accuracy.
* * Method {@link #isThreadCpuTimeSupported()} may be used to determine if * the CPU timing of threads is supported on the virtual machine. On virtual * machines where current thread CPU timing is supported, the method * {@link #isThreadCpuTimeEnabled()} may be used to determine if thread CPU * timing is actually enabled. *
* @param id * the identifier for a thread. Must be a positive number greater * than zero. * @return on virtual machines where thread CPU timing is supported and * enabled, and there is a living thread with identifier *id
, the number of nanoseconds CPU time used by
* the thread. On virtual machines where thread CPU timing is
* supported but not enabled, or where there is no living thread
* with identifier id
present in the virtual machine,
* a value of -1
is returned.
* @throws IllegalArgumentException
* if id
is <=0.
* @throws UnsupportedOperationException
* if the virtual machine does not support thread CPU timing.
* @see #isThreadCpuTimeSupported()
* @see #isThreadCpuTimeEnabled()
*/
// @ts-ignore
getThreadCpuTime(id: number /*long*/): number /*long*/
/**
* Returns a {@link ThreadInfo} object for the thread with the specified
* identifier. The returned object will not have a stack trace so that a
* call to its getStackTrace()
method will result in an empty
* StackTraceElement
array. Similarly, the returned object
* will hold no details of locked synchronizers or locked object monitors
* for the specified thread; calls to getLockedMonitors()
and
* getLockedSynchronizers
will both return array values.
* @param id
* the identifier for a thread. Must be a positive number greater
* than zero.
* @return if the supplied id
maps to a living thread in the
* virtual machine (i.e. a started thread which has not yet died),
* this method returns a {#link ThreadInfo} object corresponding to
* that thread. Otherwise, returns null
.
* @throws IllegalArgumentException
* if id
is <=0.
* @throws SecurityException
* if there is a security manager in effect and the caller does
* not have {#link ManagementPermission} of "monitor".
*/
// @ts-ignore
getThreadInfo(id: number /*long*/): java.lang.management.ThreadInfo
/**
* Returns an array of {@link ThreadInfo} objects ; one for each of the
* threads specified in the input array of identifiers. None of the objects
* in the return array will have a stack trace so that a call to its
* getStackTrace()
method will result in an empty
* StackTraceElement
array. Similarly, the returned object
* will hold no details of locked synchronizers or locked object monitors
* for the specified thread; calls to getLockedMonitors()
and
* getLockedSynchronizers
will both return array values.
* @param ids
* an array of thread identifiers. Each one must be a positive
* number greater than zero.
* @return an array of {#link ThreadInfo} objects with each entry
* corresponding to one of the threads specified in the input array
* of identifiers. The return array will therefore have an identical
* number of elements to the input ids
array. If an
* entry in the ids
array is invalid (there is no
* living thread with the supplied identifier in the virtual
* machine) then the corresponding entry in the return array will be
* a null
.
* @throws IllegalArgumentException
* if any of the entries in the ids
array is
* <=0.
* @throws SecurityException
* if there is a security manager in effect and the caller does
* not have {#link ManagementPermission} of "monitor".
*/
// @ts-ignore
getThreadInfo(ids: number /*long*/[]): java.lang.management.ThreadInfo[]
/**
* Returns an array of {@link ThreadInfo} objects ; one for each of the
* threads specified in the ids
argument. The stack trace
* information in the returned objects will depend on the value of the
* maxDepth
argument which specifies the maximum number of
* {@link StackTraceElement} instances to try and include. A subsequent call
* to any of the returned objects' getStackTrace()
method
* should result in a {@link StackTraceElement} array of up to
* maxDepth
elements. A maxDepth
value of
* Integer.MAX_VALUE
will attempt to obtain all of the stack
* trace information for each specified thread while a maxDepth
* value of zero will yield none.
*
* The returned object will hold no details of locked synchronizers or
* locked object monitors for the specified thread; calls to
* getLockedMonitors()
and
* getLockedSynchronizers
will both return array values.
*
ThreadInfo
* objects. Supplying Integer.MAX_VALUE
attempts
* to obtain all of the stack traces. Only a positive value is
* expected.
* @return an array of ThreadInfo
objects. The size of the
* array will be identical to that of the ids
* argument. Null elements will be placed in the array if the
* corresponding thread identifier in ids
does not
* resolve to a living thread in the virtual machine (i.e. a started
* thread which has not yet died).
* @throws IllegalArgumentException
* if any element in ids
is <=0.
* @throws IllegalArgumentException
* if maxDepth
is <0.
* @throws SecurityException
* if there is a security manager in effect and the caller does
* not have {#link ManagementPermission} of "monitor".
*/
// @ts-ignore
getThreadInfo(ids: number /*long*/[], maxDepth: number /*int*/): java.lang.management.ThreadInfo[]
/**
* Returns an array of {@link ThreadInfo} objects; one for each of the
* threads specified in the ids
argument. Each
* ThreadInfo
will hold details of all of the stack trace
* information for each specified thread. The returned
* ThreadInfo
objects will optionally contain details of all
* monitor objects and synchronizers locked by the corresponding thread. In
* order to retrieve locked monitor information the
* lockedMonitors
argument should be set to true
;
* in order to retrieve locked synchronizers information
* lockedSynchronizers
should be set to true
.
* For a given ThreadInfo
element of the return array the
* optional information may be inspected by calling
* {@link ThreadInfo#getLockedMonitors()} and
* {@link ThreadInfo#getLockedSynchronizers()} respectively.
*
* Both lockedMonitors
and lockedSynchronizers
* arguments should only be set to true
if the virtual
* machine supports the requested monitoring.
*
ThreadInfo
should hold information on locked
* object monitors
* @param lockedSynchronizers
* boolean indication of whether or not each returned
* ThreadInfo
should hold information on locked
* synchronizers
* @return an array of {#link ThreadInfo} objects with each entry
* corresponding to one of the threads specified in the input array
* of identifiers. The return array will therefore have an identical
* number of elements to the input ids
array. If an
* entry in the ids
array is invalid (there is no
* living thread with the supplied identifier in the virtual
* machine) then the corresponding entry in the return array will be
* a null
.
* @throws IllegalArgumentException
* if any of the entries in the ids
array is
* <=0.
* @throws SecurityException
* if there is a security manager in effect and the caller does
* not have {#link ManagementPermission} of "monitor".
* @throws UnsupportedOperationException
* if either of the following conditions apply:
* lockedMonitors
is true
but
* a call to {#link #isObjectMonitorUsageSupported()} would
* result in a false
value
* lockedSynchronizers
is true
* but a call to {@link #isSynchronizerUsageSupported()} would
* result in a false
value
* maxDepth
argument which
* specifies the maximum number of {@link StackTraceElement} instances to
* include. A subsequent call to the returned object's
* getStackTrace()
method should then result in a
* {@link StackTraceElement} array of up to maxDepth
* elements. A maxDepth
value of
* Integer.MAX_VALUE
will obtain all of the stack trace
* information for the thread while a maxDepth
value of zero
* will yield none.
*
* It is possible that the virtual machine may be unable to supply any stack
* trace information for the specified thread. In that case the returned
* ThreadInfo
object will have an empty array of
* StackTraceElement
s.
*
* The returned object will hold no details of locked synchronizers or
* locked object monitors for the specified thread; calls to
* getLockedMonitors()
and
* getLockedSynchronizers
will both return array values.
*
ThreadInfo
object.
* Supplying Integer.MAX_VALUE
obtains all of the
* stack trace. Only a positive value is expected.
* @return if the supplied id
maps to a living thread in the
* virtual machine (i.e. a started thread which has not yet died),
* this method returns a {#link ThreadInfo} object corresponding to
* that thread. Otherwise, returns null
.
* @throws IllegalArgumentException
* if id
is <=0.
* @throws IllegalArgumentException
* if maxDepth
is <0.
* @throws SecurityException
* if there is a security manager in effect and the caller does
* not have {#link ManagementPermission} of "monitor".
*/
// @ts-ignore
getThreadInfo(id: number /*long*/, maxDepth: number /*int*/): java.lang.management.ThreadInfo
/**
* If supported by the virtual machine, returns the total CPU usage time for
* the thread with the specified identifier when running in user mode. The
* returned time will have nanosecond precision but may not have nanosecond
* accuracy.
* * Method {@link #isThreadCpuTimeSupported()} may be used to determine if * the CPU timing of threads is supported on the virtual machine. On virtual * machines where current thread CPU timing is supported, the method * {@link #isThreadCpuTimeEnabled()} may be used to determine if thread CPU * timing is actually enabled. *
* @param id * the identifier for a thread. Must be a positive number greater * than zero. * @return on virtual machines where thread CPU timing is supported and * enabled, and there is a living thread with identifier *id
, the number of nanoseconds CPU time used by
* the thread running in user mode. On virtual machines where thread
* CPU timing is supported but not enabled, or where there is no
* living thread with identifier id
present in the
* virtual machine, a value of -1
is returned.
* * If thread CPU timing was disabled when the thread was started * then the virtual machine is free to choose any measurement start * time between when the virtual machine started up and when thread * CPU timing was enabled with a call to * {#link #setThreadCpuTimeEnabled(boolean)}. *
* @throws IllegalArgumentException * ifid
is <=0.
* @throws UnsupportedOperationException
* if the virtual machine does not support thread CPU timing.
* @see #isThreadCpuTimeSupported()
* @see #isThreadCpuTimeEnabled()
*/
// @ts-ignore
getThreadUserTime(id: number /*long*/): number /*long*/
/**
* Returns the number of threads that have been started in this virtual
* machine since it came into being.
* @return the total number of started threads.
*/
// @ts-ignore
getTotalStartedThreadCount(): number /*long*/
/**
* Returns a boolean indication of whether or not the virtual machine
* supports the CPU timing of the current thread.
*
* Note that this method must return true
if
* {@link #isThreadCpuTimeSupported()} returns true
.
*
true
if CPU timing of the current thread is
* supported, otherwise false
.
*/
// @ts-ignore
isCurrentThreadCpuTimeSupported(): boolean
/**
* Returns a boolean indication of whether or not the monitoring of thread
* contention situations is enabled on this virtual machine.
* @return true
if thread contention monitoring is enabled,
* false
otherwise.
*/
// @ts-ignore
isThreadContentionMonitoringEnabled(): boolean
/**
* Returns a boolean indication of whether or not the monitoring of thread
* contention situations is supported on this virtual machine.
* @return true
if thread contention monitoring is supported,
* false
otherwise.
*/
// @ts-ignore
isThreadContentionMonitoringSupported(): boolean
/**
* Returns a boolean indication of whether or not the CPU timing of threads
* is enabled on this virtual machine.
* @return true
if thread CPU timing is enabled,
* false
otherwise.
* @throws UnsupportedOperationException
* if the virtual machine does not support thread CPU timing.
* @see #isThreadCpuTimeSupported()
*/
// @ts-ignore
isThreadCpuTimeEnabled(): boolean
/**
* Returns a boolean indication of whether or not the virtual machine
* supports the CPU time measurement of any threads (current or otherwise).
* @return true
if the virtual machine supports the CPU
* timing of threads, false
otherwise.
*/
// @ts-ignore
isThreadCpuTimeSupported(): boolean
/**
* Resets the peak thread count to be the current number of threads alive in
* the virtual machine when the call is made.
* @throws SecurityException
* if there is a security manager in effect and the caller does
* not have {#link ManagementPermission} of "control".
*/
// @ts-ignore
resetPeakThreadCount(): void
/**
* Updates the virtual machine to either enable or disable the monitoring of
* thread contention situations.
* * If it is supported, the virtual machine will initially not monitor thread * contention situations. *
* @param enable * enable thread contention monitoring iftrue
,
* otherwise disable thread contention monitoring.
* @throws SecurityException
* if there is a security manager in effect and the caller does
* not have {#link ManagementPermission} of "control".
* @throws UnsupportedOperationException
* if the virtual machine does not support thread contention
* monitoring.
* @see #isThreadContentionMonitoringSupported()
*/
// @ts-ignore
setThreadContentionMonitoringEnabled(enable: boolean): void
/**
* If supported, updates the virtual machine to either enable or disable the
* CPU timing of threads.
* * The default value of this property depends on the underlying operating * system on which the virtual machine is running. *
* @param enable * enable thread CPU timing iftrue
, otherwise
* disable thread CPU timing
* @throws SecurityException
* if there is a security manager in effect and the caller does
* not have {#link ManagementPermission} of "control".
* @throws UnsupportedOperationException
* if the virtual machine does not support thread CPU timing.
* @see #isThreadCpuTimeSupported()
*/
// @ts-ignore
setThreadCpuTimeEnabled(enable: boolean): void
/**
* Returns a boolean indication of whether or not the virtual machine
* supports the monitoring of object monitor usage.
* @return true
if object monitor usage is permitted,
* otherwise false
* @since 1.6
*/
// @ts-ignore
isObjectMonitorUsageSupported(): boolean
/**
* Returns a boolean indication of whether or not the virtual machine
* supports the monitoring of ownable synchronizers (synchronizers that make
* use of the AbstractOwnableSynchronizer
type and which are
* completely owned by a single thread).
* @return true
if synchronizer usage monitoring is
* permitted, otherwise false
*/
// @ts-ignore
isSynchronizerUsageSupported(): boolean
/**
* If supported by the virtual machine, this method can be used to retrieve
* the long
id of all threads currently waiting on object
* monitors or ownable synchronizers (synchronizers that make use of the
* AbstractOwnableSynchronizer
type and which are completely
* owned by a single thread). To determine the threads currently deadlocked
* by object monitors only use the {@link #findMonitorDeadlockedThreads()}
* method.
* * It is recommended that this method be used solely for problem * determination analysis and not as a means of managing thread * synchronization in a virtual machine. This is because the method may be * very expensive to run. *
* @return an array of the identifiers of every thread in the virtual * machine that has been detected as currently being in a deadlock * situation involving object monitors and ownable * synchronizers. If there are no threads in this category a *null
is returned.
* @throws SecurityException
* if there is a security manager in effect and the caller does
* not have {#link ManagementPermission} of "monitor".
* @throws UnsupportedOperationException
* if the virtual machine does not support any monitoring of
* ownable synchronizers.
* @see #isSynchronizerUsageSupported()
*/
// @ts-ignore
findDeadlockedThreads(): number /*long*/[]
/**
* Returns an array of {@link ThreadInfo} objects holding information on all
* threads that were alive when the call was invoked.
* @param lockedMonitors
* boolean indication of whether or not information on all
* currently locked object monitors is to be included in the
* returned array
* @param lockedSynchronizers
* boolean indication of whether or not information on all
* currently locked ownable synchronizers is to be included in
* the returned array
* @return an array of ThreadInfo
objects
* @throws SecurityException
* if there is a security manager in effect and the caller does
* not have {#link ManagementPermission} of "monitor".
* @throws UnsupportedOperationException
* if either of the following conditions apply:
* lockedMonitors
is true
but
* a call to {#link #isObjectMonitorUsageSupported()} would
* result in a false
value
* lockedSynchronizers
is true
* but a call to {@link #isSynchronizerUsageSupported()} would
* result in a false
value
*