edu.rice.cs.plt.debug
Class ThreadSnapshot

java.lang.Object
  extended by edu.rice.cs.plt.debug.ThreadSnapshot
All Implemented Interfaces:
Serializable

public class ThreadSnapshot
extends Object
implements Serializable

A serializable and immutable view of a Thread at a particular time.

See Also:
Serialized Form

Constructor Summary
ThreadSnapshot()
           
ThreadSnapshot(Thread t)
           
 
Method Summary
 StackTraceElement callingLocation()
          The second stack element at snapshot time, or null if unavailable.
 long getId()
          The result of Thread.getId() at the snapshot time.
 String getName()
          The result of Thread.getName() at the snapshot time.
 int getPriority()
          The result of Thread.getPriority() at the snapshot time.
 SizedIterable<StackTraceElement> getStackTrace()
          The stack trace at creation time, as returned by Thread.getStackTrace().
 Thread.State getState()
          The result of Thread.getState() at the snapshot time.
 String getThreadGroup()
          The name of t's ThreadGroup at the snapshot time, as returned by Thread.getThreadGroup(), or null if it did not have one.
 boolean isAlive()
          The result of Thread.isAlive() at the snapshot time.
 boolean isDaemon()
          The result of Thread.isDaemon() at the snapshot time.
 boolean isInterrupted()
          The result of Thread.isInterrupted() at the snapshot time.
 StackTraceElement runningLocation()
          The top of the stack at snapshot time, or null if unavailable.
 Date snapshotTime()
          The time at which the snapshot was taken.
 String toString()
          Produce a string representation of the thread, as would be returned by Thread.toString() at snapshot time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ThreadSnapshot

public ThreadSnapshot()

ThreadSnapshot

public ThreadSnapshot(Thread t)
Method Detail

getName

public String getName()
The result of Thread.getName() at the snapshot time.


getId

public long getId()
The result of Thread.getId() at the snapshot time.


isDaemon

public boolean isDaemon()
The result of Thread.isDaemon() at the snapshot time.


getPriority

public int getPriority()
The result of Thread.getPriority() at the snapshot time.


getThreadGroup

public String getThreadGroup()
The name of t's ThreadGroup at the snapshot time, as returned by Thread.getThreadGroup(), or null if it did not have one.


snapshotTime

public Date snapshotTime()
The time at which the snapshot was taken.


getStackTrace

public SizedIterable<StackTraceElement> getStackTrace()
The stack trace at creation time, as returned by Thread.getStackTrace(). If the thread was used to take a snapshot of itself, the relevant ThreadSnapshot invocations are hidden in the result. Note that Thread.getStackTrace() does not guarantee complete results, and the trace may even be empty.


runningLocation

public StackTraceElement runningLocation()
The top of the stack at snapshot time, or null if unavailable. If the thread was used to take a snapshot of itself, the relevant ThreadSnapshot invocations are hidden in the result.


callingLocation

public StackTraceElement callingLocation()
The second stack element at snapshot time, or null if unavailable. If the thread was used to take a snapshot of itself, the relevant ThreadSnapshot invocations are hidden in the result.


getState

public Thread.State getState()
The result of Thread.getState() at the snapshot time.


isAlive

public boolean isAlive()
The result of Thread.isAlive() at the snapshot time.


isInterrupted

public boolean isInterrupted()
The result of Thread.isInterrupted() at the snapshot time.


toString

public String toString()
Produce a string representation of the thread, as would be returned by Thread.toString() at snapshot time.

Overrides:
toString in class Object