public class ThreadInfo extends Object
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compares the argument to the receiver, and answers true
if they represent the same object using a class
specific comparison.
|
static ThreadInfo |
from(CompositeData cd)
Receives a
CompositeData representing a ThreadInfo
object and attempts to return the root ThreadInfo
instance. |
long |
getBlockedCount()
Returns the number of times that the thread represented by this
ThreadInfo has been blocked on any monitor objects. |
long |
getBlockedTime()
If thread contention monitoring is supported and enabled, returns the
total amount of time that the thread represented by this
ThreadInfo has spent blocked on any monitor objects. |
MonitorInfo[] |
getLockedMonitors()
Returns an array of
MonitorInfo objects, one for every
monitor object locked by the Thread corresponding to this
ThreadInfo when it was instantiated. |
LockInfo[] |
getLockedSynchronizers()
Returns an array of
LockInfo objects, each one containing
information on an ownable synchronizer (a synchronizer that makes use of
the AbstractOwnableSynchronizer type and which is
completely owned by a single thread) locked by the Thread
corresponding to this ThreadInfo when it was instantiated. |
LockInfo |
getLockInfo()
If the thread corresponding to this
ThreadInfo is blocked
then this method returns a LockInfo object that contains details
of the associated lock object. |
String |
getLockName()
If the thread represented by this
ThreadInfo is currently
blocked on or waiting on a monitor object, returns a string
representation of that monitor object. |
long |
getLockOwnerId()
If the thread represented by this
ThreadInfo is currently
blocked on or waiting on a monitor object, returns the thread identifier
of the thread which owns the monitor. |
String |
getLockOwnerName()
If the thread represented by this
ThreadInfo is currently
blocked on or waiting on a monitor object, returns the name of the thread
which owns the monitor. |
StackTraceElement[] |
getStackTrace()
If available, returns the stack trace for the thread represented by this
ThreadInfo instance. |
long |
getThreadId()
Returns the thread identifier of the thread represented by this
ThreadInfo . |
String |
getThreadName()
Returns the name of the thread represented by this
ThreadInfo . |
Thread.State |
getThreadState()
Returns the thread state value of the thread represented by this
ThreadInfo . |
long |
getWaitedCount()
The number of times that the thread represented by this
ThreadInfo has gone to the "wait" or "timed
wait" state. |
long |
getWaitedTime()
If thread contention monitoring is supported and enabled, returns the
total amount of time that the thread represented by this
ThreadInfo has spent waiting for notifications. |
int |
hashCode()
Answers an integer hash code for the receiver.
|
boolean |
isInNative()
Returns a
boolean indication of whether or not the thread
represented by this ThreadInfo is currently in a native
method. |
boolean |
isSuspended()
Returns a
boolean indication of whether or not the thread
represented by this ThreadInfo is currently suspended. |
String |
toString()
Answers a string containing a concise, human-readable
description of the receiver.
|
public long getBlockedCount()
ThreadInfo
has been blocked on any monitor objects. The
count is from the start of the thread's life.public long getBlockedTime()
ThreadInfo
has spent blocked on any monitor objects. The
time is measured in milliseconds and will be measured over the time period
since thread contention was most recently enabled.ThreadInfo
has spent blocked on any monitors. If
thread contention monitoring is supported but currently disabled,
-1
.UnsupportedOperationException
- if the virtual machine does not support thread contention
monitoring.ThreadMXBean.isThreadContentionMonitoringSupported()
,
ThreadMXBean.isThreadContentionMonitoringEnabled()
public String getLockName()
ThreadInfo
is currently
blocked on or waiting on a monitor object, returns a string
representation of that monitor object.
The monitor's string representation is comprised of the following component parts:
monitor
class name
@
Integer.toHexString(System.identityHashCode(monitor))
null
.Integer.toHexString(int)
,
System.identityHashCode(java.lang.Object)
public long getLockOwnerId()
ThreadInfo
is currently
blocked on or waiting on a monitor object, returns the thread identifier
of the thread which owns the monitor.ThreadInfo
is
blocked or waiting on. If this ThreadInfo
's
associated thread is currently not blocked or waiting, or there
is no other thread holding the monitor, returns a -1
.public String getLockOwnerName()
ThreadInfo
is currently
blocked on or waiting on a monitor object, returns the name of the thread
which owns the monitor.ThreadInfo
is blocked
or waiting on. If this ThreadInfo
's associated
thread is currently not blocked or waiting, or there is no other
thread holding the monitor, returns a null
reference.public LockInfo getLockInfo()
ThreadInfo
is blocked
then this method returns a LockInfo
object that contains details
of the associated lock object.LockInfo
object if this ThreadInfo
's
thread is currently blocked, else null
.public StackTraceElement[] getStackTrace()
ThreadInfo
instance. The stack trace is returned in an
array of StackTraceElement
objects with the "top" of the
stack encapsulated in the first array element and the "bottom"
of the stack in the last array element.
If this ThreadInfo
was created without any stack trace
information (e.g. by a call to ThreadMXBean.getThreadInfo(long)
)
then the returned array will have a length of zero.
ThreadInfo
.public long getThreadId()
ThreadInfo
.ThreadInfo
.public String getThreadName()
ThreadInfo
.ThreadInfo
.public Thread.State getThreadState()
ThreadInfo
.ThreadInfo
.Thread.getState()
public long getWaitedCount()
ThreadInfo
has gone to the "wait" or "timed
wait" state.public long getWaitedTime()
ThreadInfo
has spent waiting for notifications. The time
is measured in milliseconds and will be measured over the time period
since thread contention was most recently enabled.ThreadInfo
has spent waiting notifications. If
thread contention monitoring is supported but currently disabled,
-1
.UnsupportedOperationException
- if the virtual machine does not support thread contention
monitoring.ThreadMXBean.isThreadContentionMonitoringSupported()
,
ThreadMXBean.isThreadContentionMonitoringEnabled()
public boolean isInNative()
boolean
indication of whether or not the thread
represented by this ThreadInfo
is currently in a native
method.true
, otherwise false
.public boolean isSuspended()
boolean
indication of whether or not the thread
represented by this ThreadInfo
is currently suspended.true
, otherwise false
.public MonitorInfo[] getLockedMonitors()
MonitorInfo
objects, one for every
monitor object locked by the Thread
corresponding to this
ThreadInfo
when it was instantiated.MonitorInfo
objects - one for each object monitor locked by this
ThreadInfo
object's corresponding thread. If no
monitors are locked by the thread then the array will have a
length of zero.public LockInfo[] getLockedSynchronizers()
LockInfo
objects, each one containing
information on an ownable synchronizer (a synchronizer that makes use of
the AbstractOwnableSynchronizer
type and which is
completely owned by a single thread) locked by the Thread
corresponding to this ThreadInfo
when it was instantiated.LockInfo
objects - one for each ownable synchronizer locked by this
ThreadInfo
object's corresponding thread. If no
ownable synchronizer are locked by the thread then the array will
have a length of zero.public static ThreadInfo from(CompositeData cd)
CompositeData
representing a ThreadInfo
object and attempts to return the root ThreadInfo
instance.cd
- a CompositeData
that represents a
ThreadInfo
.cd
is non- null
, returns a new
instance of ThreadInfo
. If cd
is
null
, returns null
.IllegalArgumentException
- if argument cd
does not correspond to a
ThreadInfo
with the following attributes:
threadId
(java.lang.Long
)
threadName
(
java.lang.String
)
threadState
(
java.lang.String
)
suspended
(
java.lang.Boolean
)
inNative
(java.lang.Boolean
)
blockedCount
(
java.lang.Long
)
blockedTime
(java.lang.Long
)
waitedCount
(java.lang.Long
)
waitedTime
(java.lang.Long
)
lockInfo
(javax.management.openmbean.CompositeData
)
which holds the simple attributes className
(java.lang.String
),
identityHashCode
(java.lang.Integer
).
In the event that the input CompositeData
does not hold a
lockInfo
attribute, the value of the lockName
attribute is used for setting the returned object's
LockInfo
state.
lockName
(java.lang.String
)
lockOwnerId
(java.lang.Long
)
lockOwnerName
(java.lang.String
)
stackTrace
(javax.management.openmbean.CompositeData[]
)
stackTrace
array must
correspond to a java.lang.StackTraceElement
and have the following attributes :
className
(java.lang.String
)
methodName
(java.lang.String
)
fileName
(java.lang.String
)
lineNumber
(java.lang.Integer
)
nativeMethod
(java.lang.Boolean
)
public String toString()
Object
public boolean equals(Object obj)
equals
in class Object
obj
- Object
the object to compare with this object.true
if the object is the same as this object
false
if it is different from this object.Object.hashCode()
public int hashCode()
true
when passed to
.equals
must answer the same value for this
method.hashCode
in class Object
Object.equals(java.lang.Object)
Eclipse OpenJ9 website.
To raise a bug report or suggest an improvement create an Eclipse OpenJ9 issue.
Copyright © 1993, 2025 IBM Corp. and others.