-
- All Known Implementing Classes:
DTFJJavaThread
,JavaThread
,JCJavaThread
,PHDCorruptJavaThread
,PHDJavaThread
public interface JavaThread
Represents a Java thread.- See Also:
JavaRuntime.getThreads()
-
-
Field Summary
Fields Modifier and Type Field Description static int
STATE_ALIVE
The thread is alivestatic int
STATE_BLOCKED_ON_MONITOR_ENTER
The thread is waiting to enter an object monitorstatic int
STATE_IN_NATIVE
The thread is in native codestatic int
STATE_IN_OBJECT_WAIT
The thread is in Object.waitstatic int
STATE_INTERRUPTED
The thread has a pending interruptstatic int
STATE_PARKED
The thread has been deliberately removed from schedulingstatic int
STATE_RUNNABLE
The thread can be run although may not be actually runningstatic int
STATE_SLEEPING
The thread is in the Thread.sleep methodstatic int
STATE_SUSPENDED
The thread has been suspended by Thread.suspendstatic int
STATE_TERMINATED
The thread has terminatedstatic int
STATE_VENDOR_1
The thread is in a vendor specific statestatic int
STATE_VENDOR_2
The thread is in a vendor specific statestatic int
STATE_VENDOR_3
The thread is in a vendor specific statestatic int
STATE_WAITING
The thread is in a waiting state in native codestatic int
STATE_WAITING_INDEFINITELY
The thread is waiting on a monitor with no timeout value setstatic int
STATE_WAITING_WITH_TIMEOUT
The thread is waiting on a monitor but will timeout at some point
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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.JavaObject
getBlockingObject()
For threads that are in STATE_BLOCKED_ON_MONITOR_ENTER this method returns the JavaObject who's monitor they are blocked on.ImageThread
getImageThread()
Represents the joining point between the Java view of execution and the corresponding native view.ImagePointer
getJNIEnv()
Get the address of the JNIEnv structure which represents this thread instance in JNI.String
getName()
Return the name of the thread.JavaObject
getObject()
Fetch the java.lang.Thread associated with this thread.int
getPriority()
Get the Java priority of the thread.Iterator
getStackFrames()
Get the set of stack frames.Iterator
getStackSections()
Get the set of ImageSections which make up the managed stack.int
getState()
Get the state of the thread when the image was created.int
hashCode()
Answers an integer hash code for the receiver.
-
-
-
Field Detail
-
STATE_ALIVE
static final int STATE_ALIVE
The thread is alive- See Also:
- Constant Field Values
-
STATE_TERMINATED
static final int STATE_TERMINATED
The thread has terminated- See Also:
- Constant Field Values
-
STATE_RUNNABLE
static final int STATE_RUNNABLE
The thread can be run although may not be actually running- See Also:
- Constant Field Values
-
STATE_WAITING_INDEFINITELY
static final int STATE_WAITING_INDEFINITELY
The thread is waiting on a monitor with no timeout value set- See Also:
- Constant Field Values
-
STATE_WAITING_WITH_TIMEOUT
static final int STATE_WAITING_WITH_TIMEOUT
The thread is waiting on a monitor but will timeout at some point- See Also:
- Constant Field Values
-
STATE_SLEEPING
static final int STATE_SLEEPING
The thread is in the Thread.sleep method- See Also:
- Constant Field Values
-
STATE_WAITING
static final int STATE_WAITING
The thread is in a waiting state in native code- See Also:
- Constant Field Values
-
STATE_IN_OBJECT_WAIT
static final int STATE_IN_OBJECT_WAIT
The thread is in Object.wait- See Also:
- Constant Field Values
-
STATE_PARKED
static final int STATE_PARKED
The thread has been deliberately removed from scheduling- See Also:
- Constant Field Values
-
STATE_BLOCKED_ON_MONITOR_ENTER
static final int STATE_BLOCKED_ON_MONITOR_ENTER
The thread is waiting to enter an object monitor- See Also:
- Constant Field Values
-
STATE_SUSPENDED
static final int STATE_SUSPENDED
The thread has been suspended by Thread.suspend- See Also:
- Constant Field Values
-
STATE_INTERRUPTED
static final int STATE_INTERRUPTED
The thread has a pending interrupt- See Also:
- Constant Field Values
-
STATE_IN_NATIVE
static final int STATE_IN_NATIVE
The thread is in native code- See Also:
- Constant Field Values
-
STATE_VENDOR_1
static final int STATE_VENDOR_1
The thread is in a vendor specific state- See Also:
- Constant Field Values
-
STATE_VENDOR_2
static final int STATE_VENDOR_2
The thread is in a vendor specific state- See Also:
- Constant Field Values
-
STATE_VENDOR_3
static final int STATE_VENDOR_3
The thread is in a vendor specific state- See Also:
- Constant Field Values
-
-
Method Detail
-
getJNIEnv
ImagePointer getJNIEnv() throws CorruptDataException
Get the address of the JNIEnv structure which represents this thread instance in JNI.- Returns:
- the address of the JNIEnv structure which represents this thread instance in JNI
- Throws:
CorruptDataException
-
getPriority
int getPriority() throws CorruptDataException
Get the Java priority of the thread.- Returns:
- the Java priority of the thread (a number between 1 and 10 inclusive)
- Throws:
CorruptDataException
- See Also:
Thread.getPriority()
-
getObject
JavaObject getObject() throws CorruptDataException
Fetch the java.lang.Thread associated with this thread. If the thread is in the process of being attached, this may return null.- Returns:
- the a JavaObject representing the java.lang.Thread associated with this thread
- Throws:
CorruptDataException
- See Also:
JavaObject
,Thread
-
getState
int getState() throws CorruptDataException
Get the state of the thread when the image was created.- Returns:
- the state of the thread when the image was created. The result is a bit vector, and uses the states defined by the JVMTI specification.
- Throws:
CorruptDataException
-
getImageThread
ImageThread getImageThread() throws CorruptDataException, DataUnavailable
Represents the joining point between the Java view of execution and the corresponding native view. This method is where the mapping from Java into native threading resources is provided.- Returns:
- the ImageThread which this ManagedThread is currently bound to.
- Throws:
CorruptDataException
- If the underlying resource describing the native representation of the thread is damagedDataUnavailable
- If no mapping is provided due to missing or limited underlying resources (this exception added in DTFJ 1.1)- See Also:
ImageThread
-
getStackSections
Iterator getStackSections()
Get the set of ImageSections which make up the managed stack.- Returns:
- a collection of ImageSections which make up the managed stack.
Some Runtime implementations may also use parts of the ImageThread's stack for ManagesStackFrames
- See Also:
ImageSection
,ImageThread.getStackSections()
,CorruptData
-
getStackFrames
Iterator getStackFrames()
Get the set of stack frames.- Returns:
- an iterator to walk the managed stack frames in order from top-of-stack (that is, the most recent frame) to bottom-of-stack
- See Also:
JavaStackFrame
,CorruptData
-
getName
String getName() throws CorruptDataException
Return the name of the thread. Usually this is derived from the object associated with the thread, but if the name cannot be derived this way (e.g. there is no object associated with the thread) DTFJ will synthesize a name for the thread.- Returns:
- the name of the thread
- Throws:
CorruptDataException
-
getBlockingObject
JavaObject getBlockingObject() throws CorruptDataException, DataUnavailable
For threads that are in STATE_BLOCKED_ON_MONITOR_ENTER this method returns the JavaObject who's monitor they are blocked on. For threads that are in STATE_IN_OBJECT_WAIT this method returns the JavaObject that Object.wait() was called on. For threads that are in STATE_PARKED this method returns the JavaObject that was passed as the "blocker" object to the java.util.concurrent.LockSupport.park() call. It may return null if no blocker object was passed. For threads in any other state this call will return null. The state of the thread can be determined by calling JavaThread.getState()- Returns:
- the object this thread is waiting on or null.
- Throws:
CorruptDataException
DataUnavailable
- Since:
- 1.6
-
equals
boolean equals(Object obj)
Description copied from class:java.lang.Object
Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison. The implementation in Object answers true only if the argument is the exact same object as the receiver (==).- Overrides:
equals
in classObject
- Parameters:
obj
-- Returns:
- True if the given object refers to the same Java Thread in the image
- See Also:
Object.hashCode()
-
hashCode
int hashCode()
Description copied from class:java.lang.Object
Answers an integer hash code for the receiver. Any two objects which answertrue
when passed to.equals
must answer the same value for this method.- Overrides:
hashCode
in classObject
- Returns:
- the receiver's hash.
- See Also:
Object.equals(java.lang.Object)
-
-