is new.
java.lang.Objectjava.lang.management.ThreadInfo
public class ThreadInfo
Thread information. ThreadInfo contains the information about a thread including:
due to:
block/method,
parking due to a
LockSupport.park
This thread information class is designed for use in monitoring of the system, not for synchronization control.
is mapped to a CompositeData with attributes as specified in the
from
| Method Summary | |
|---|---|
| static ThreadInfo |
from
(javax.management.openmbean.CompositeData cd)
Returns a ThreadInfo object represented by the given CompositeData . |
| long |
getBlockedCount
() Returns the total number of times that the thread associated with this ThreadInfo blocked to enter or reenter a monitor. |
| long |
getBlockedTime
() Returns the approximate accumulated elapsed time (in milliseconds) that the thread associated with this ThreadInfo has blocked to enter or reenter a monitor since thread contention monitoring is enabled. |
LockInfo
|
getLockInfo
Returns the
LockInfo
an object for which
the
waiting.
|
String
|
getLockName
Returns the
string representation
blocked waiting.
|
long
|
getLockOwnerId
Returns the
ID
owns
for
blocked waiting.
|
String
|
getLockOwnerName
()
Returns the name of the thread which owns the object for which the thread associated with this
ThreadInfo
is blocked waiting.
|
| StackTraceElement [] |
getStackTrace
() Returns the stack trace of the thread associated with this ThreadInfo . |
| long |
getThreadId
() Returns the ID of the thread associated with this ThreadInfo . |
| String |
getThreadName
() Returns the name of the thread associated with this ThreadInfo . |
| Thread.State |
getThreadState
() Returns the state of the thread associated with this ThreadInfo . |
| long |
getWaitedCount
() Returns the total number of times that the thread associated with this ThreadInfo waited for notification. |
| long |
getWaitedTime
() Returns the approximate accumulated elapsed time (in milliseconds) that the thread associated with this ThreadInfo has waited for notification since thread contention monitoring is enabled. |
| boolean |
isInNative
() Tests if the thread associated with this ThreadInfo is executing native code via the Java Native Interface (JNI). |
| boolean |
isSuspended
() Tests if the thread associated with this ThreadInfo is suspended. |
| String |
toString
() Returns a string representation of this thread info. |
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait |
| Method Detail |
|---|
public long getThreadId()
public String getThreadName()
public Thread.State getThreadState()
public long getBlockedTime()
The Java virtual machine may measure the time with a high resolution timer. This statistic is reset when the thread contention monitoring is reenabled.
public long getBlockedCount()
public long getWaitedTime()
The Java virtual machine may measure the time with a high resolution timer. This statistic is reset when the thread contention monitoring is reenabled.
public long getWaitedCount()
getLockInfo
public
LockInfo
getLockInfo
()
Returns the
LockInfo
of an object for which the thread associated with this
ThreadInfo
is blocked waiting. A thread can be blocked waiting for one of the following:
an object monitor to be acquired for entering or reentering a synchronization block/method.
The thread is in the
BLOCKED
synchronized
statement or method.
an object monitor to be notified by another thread.
The thread is in the
WAITING
or
TIMED_WAITING
state due to a call to the
Object.wait
a synchronization object responsible for the thread parking.
The thread is in the
WAITING
or
TIMED_WAITING
state due to a call to the
LockSupport.park
method. The synchronization object is the object returned from
LockSupport.getBlocker
method. Typically it is an
ownable synchronizer
or a
Condition
This method returns
null
if the thread is not in any of the above conditions.
Returns:
LockInfo
of an object for which the thread is blocked waiting if any;
null
otherwise.
Since:
1.6
public String getLockName()
string representation
an object for which
the
is blocked waiting. This method is equivalent to calling:
getLockInfo().toString()
lock.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(lock))
This method will return
If the thread is not blocking to enter on any monitor object, or is not waiting on a monitor object for notification in a
Object.wait
call, this method returns
null
if this thread is not blocked waiting for any object or if the object is not owned by any thread.
.
the string representation of the object on which the thread is blocked if any;
See Also:
getLockInfo()
public long getLockOwnerId()
owns
for
is blocked waiting.
for
object
object
owned
blocked
object lis
owned
getLockInfo()
public String getLockOwnerName()
owns
for
is blocked waiting.
for
object
object
owned
owns
blocked
object
owned
getLockInfo()
public StackTraceElement[] getStackTrace()
Some Java virtual machines may, under some circumstances, omit one or more stack frames from the stack trace. In the extreme case, a virtual machine that has no stack trace information concerning the thread associated with this ThreadInfo is permitted to return a zero-length array from this method.
public boolean isSuspended()
public boolean isInNative()
public String toString()
public static ThreadInfofrom(javax.management.openmbean.CompositeData cd)
(CompositeDatacd)
attributes unless otherwise specified below:
Attribute Name Type 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
CompositeData as specified in the
LockInfo.from
If
cd
does not contain this attribute, the
LockInfo
object will be constructed from the value of the
lockName
attribute.
lockName java.lang.String lockOwnerId java.lang.Long lockOwnerName java.lang.String stackTrace
![]()
stackTracejavax.management.openmbean.CompositeData[] Each element is a CompositeData representing StackTraceElement containing the following attributes:
Attribute Name Type className java.lang.String methodName java.lang.String fileName java.lang.String lineNumber java.lang.Integer nativeMethod java.lang.Boolean