Name

ThreadInfo

Synopsis

This class represents information about a thread from a ThreadMXBean. Some information, such as thread name, id, state, and stack trace are also available through the java.lang.Thread object. Other more useful information includes the object upon which a thread is waiting and the owner of the lock that the thread is trying to acquire. If ThreadMXBean indicates that thread contention monitoring is supported and enabled, the ThreadInfo methods getBlockedCount( ) and getBlockedTime( ) return the number of times the thread has blocked or waited and the amount of time it has spent in the blocked and waiting states.

public class ThreadInfo {
// No Constructor
                  // Public Class Methods
     public static ThreadInfo from(javax.management.openmbean.CompositeData cd);  
// Public Instance Methods
     public long getBlockedCount( );  
     public long getBlockedTime( );  
     public String getLockName( );  
     public long getLockOwnerId( );  
     public String getLockOwnerName( );  
     public StackTraceElement[ ] getStackTrace( );  
     public long getThreadId( );  
     public String getThreadName( );  
     public Thread.State getThreadState( );  
     public long getWaitedCount( );  
     public long getWaitedTime( );  
     public boolean isInNative( );  
     public boolean isSuspended( );  
// Public Methods Overriding Object
     public String toString( );  
}

Returned By

ThreadMXBean.getThreadInfo( )

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.