edu.rice.cs.cunit.record.graph
Class ThreadInfo

java.lang.Object
  extended by edu.rice.cs.cunit.record.graph.ThreadInfo
All Implemented Interfaces:
IThreadInfo, IVerboseToString

public class ThreadInfo
extends java.lang.Object
implements IThreadInfo

Information about a thread. Essentially captures the information that a ThreadReference contains, but this class allows the information to be stored so that the monitored VM can be resumed.

Author:
Mathias Ricken

Field Summary
(package private)  java.lang.Long _contendedLockId
          Unique id of the lock the thread is waiting for, or null if none.
(package private)  java.lang.String _name
          Name of the thread.
(package private)  java.util.Set<java.lang.Long> _ownedLockIds
          Set of the unique ids of locks owned.
(package private)  java.util.LinkedList<StackFrameInfo> _stackFrame
          List of state frame entries.
(package private)  int _status
          Thread Status.
(package private)  long _threadID
          Unique ID of thread.
 
Constructor Summary
ThreadInfo(long uniqueId, int status, java.lang.String name, java.lang.Long contendedLockId, java.util.Set<java.lang.Long> ownedLockIds, java.util.List<StackFrameInfo> stackFrame)
          Constructor for thread info.
ThreadInfo(com.sun.jdi.ThreadReference tRef)
          Constructor for thread info.
 
Method Summary
 java.lang.Long getContendedLockID()
          Returns the id of the contended lock, or null if none.
 java.lang.String getName()
          Returns the name of the thread.
 java.util.Set<java.lang.Long> getOwnedLockIDs()
          Returns a set with the ids of the owned locks.
 java.util.List<StackFrameInfo> getStackFrame()
          Returns a list with state frame information.
 int getStatus()
          Returns the status of the thread.
 long getThreadID()
          Returns the unique id of this thread.
 void setContendedLockId(java.lang.Long contendedLockId)
          Sets the id of the contented lock, or null if none.
 void setStatus(int status)
          Sets the status of the thread.
 java.lang.String toString()
          Returns a string representation of the object.
 java.lang.String toStringExtended(java.util.Map<java.lang.Long,LockInfo> lockInfo)
          Returns a very verbose string representation of the object.
 java.lang.String toStringVerbose()
          Returns a compact string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_threadID

long _threadID
Unique ID of thread.


_status

int _status
Thread Status.


_name

java.lang.String _name
Name of the thread.


_contendedLockId

java.lang.Long _contendedLockId
Unique id of the lock the thread is waiting for, or null if none.


_ownedLockIds

java.util.Set<java.lang.Long> _ownedLockIds
Set of the unique ids of locks owned.


_stackFrame

java.util.LinkedList<StackFrameInfo> _stackFrame
List of state frame entries.

Constructor Detail

ThreadInfo

public ThreadInfo(long uniqueId,
                  int status,
                  java.lang.String name,
                  java.lang.Long contendedLockId,
                  java.util.Set<java.lang.Long> ownedLockIds,
                  java.util.List<StackFrameInfo> stackFrame)
Constructor for thread info.

Parameters:
uniqueId - thread's unique id
status - thread status
name - thread name
contendedLockId - id of contended lock
ownedLockIds - set of ids of ownned locks
stackFrame - list of state frame infos

ThreadInfo

public ThreadInfo(com.sun.jdi.ThreadReference tRef)
Constructor for thread info.

Parameters:
tRef - Thread Reference
Method Detail

getThreadID

public long getThreadID()
Returns the unique id of this thread.

Specified by:
getThreadID in interface IThreadInfo
Returns:
unique id

getStatus

public int getStatus()
Returns the status of the thread.

Returns:
status

setStatus

public void setStatus(int status)
Sets the status of the thread.

Parameters:
status - new status

getName

public java.lang.String getName()
Returns the name of the thread.

Returns:
name

getContendedLockID

public java.lang.Long getContendedLockID()
Returns the id of the contended lock, or null if none.

Returns:
id of the contended lock, or null if none

setContendedLockId

public void setContendedLockId(java.lang.Long contendedLockId)
Sets the id of the contented lock, or null if none.

Parameters:
contendedLockId - new lock id, or null if none

getOwnedLockIDs

public java.util.Set<java.lang.Long> getOwnedLockIDs()
Returns a set with the ids of the owned locks.

Returns:
list with lock ids

getStackFrame

public java.util.List<StackFrameInfo> getStackFrame()
Returns a list with state frame information.

Returns:
list with state frame info

toString

public java.lang.String toString()
Returns a string representation of the object.

Specified by:
toString in interface IThreadInfo
Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.

toStringExtended

public java.lang.String toStringExtended(java.util.Map<java.lang.Long,LockInfo> lockInfo)
Returns a very verbose string representation of the object.

Parameters:
lockInfo - map from unique ids to lock information
Returns:
a verbose string representation of the object.

toStringVerbose

public java.lang.String toStringVerbose()
Returns a compact string representation of the object.

Specified by:
toStringVerbose in interface IVerboseToString
Returns:
a compact string representation of the object.