th.co.edge.jseq
Class EventThread

java.lang.Object
  extended by java.lang.Thread
      extended by th.co.edge.jseq.EventThread
All Implemented Interfaces:
java.lang.Runnable

public class EventThread
extends java.lang.Thread

An EventThred traces the execution of a Java process, keeping track of all method calls as Activations in an ActivationList containing all root activations, that is, all method calls that occur "magically" from outside the traced methods, for example from the main method. Each Java thread is traced as a separate root activation.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
EventThread(com.sun.jdi.VirtualMachine vm, ActivationList rootActivations, java.util.List<java.lang.String> includes, java.util.List<java.lang.String> excludes, java.util.List<java.lang.String> boundaryMethods, boolean trace)
          Creates a new EventThread that traces a given JDI VirtualMachine, filling in a list of root activations.
 
Method Summary
 void run()
          Handles all events generated by JDI, running for as long as the Java process is active, or until an attached process disconnects the event thread.
 void setEventRequests(java.lang.String startMethod)
          Creates all JDI event requests, that is, defines the set of events that will be handled by this EventThread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventThread

public EventThread(com.sun.jdi.VirtualMachine vm,
                   ActivationList rootActivations,
                   java.util.List<java.lang.String> includes,
                   java.util.List<java.lang.String> excludes,
                   java.util.List<java.lang.String> boundaryMethods,
                   boolean trace)
Creates a new EventThread that traces a given JDI VirtualMachine, filling in a list of root activations.

A list of included and excluded method names determine which methods to trace. If the list of included method names is empty, all methods except the excluded ones are traced, and correspondingly if the list of excluded method name is empty. If both lists are non-empty, only the methods in the included list are traced, except the ones in the excluded list. Method names in the included and excluded lists can either be a fully qualified method name, or a simple wild-card expression starting or ending with "*".

For example, if the included list contains "foo.Bar.*", and the excluded list is empty, all methods in the class foo.Bar will be traced. If the included list is empty and the excluded list contains "java.*", everything but methods in the java package will be traced. Finally, if the included list contains "foo.Bar.*" and the excluded list contains "foo.Bar.baz", all methods in the class foo.Bar will be traced, except for the method baz.

It is also possible to specify a list of boundary methods. A bounday method is a method where tracing stops at entry to the method and is resumed when the method exits. This list should contain fully qualified method names, no wild-cards are accepted.

For example, if the list of boundary methods contains "foo.Bar.baz", tracing will include the call to baz, but no methods called by baz. Normal tracing is resumed after baz returns.

Parameters:
vm - the JDI VirtualMachine, a representation of the Java process to trace
rootActivations - the list of root activations that will be filled in during the program trace
includes - a list of method name pattern that will be included in the program trace, where name patterns may start or end with the wild-card "*"
excludes - a list of method name patterns that will be excluded in the program trace, where name patterns may start or end with the wild-card "*"
boundaryMethods - a list of boundary methods, methods where tracing will stop during the execution of the method
trace - if true the program trace (method entry and exit, for example) will be echoed to System.out
Method Detail

run

public void run()
Handles all events generated by JDI, running for as long as the Java process is active, or until an attached process disconnects the event thread.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

setEventRequests

public void setEventRequests(java.lang.String startMethod)
Creates all JDI event requests, that is, defines the set of events that will be handled by this EventThread.

Parameters:
startMethod - the fully qualified name of the method where tracing should start, or null if tracing should start immediately


Copyright © 2008 Edge Software, Co., Ltd.. All Rights Reserved.