|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.ExecutingMethod
public class ExecutingMethod
A static class that allows tracing of the currently executing method.
WARNING: This class is not independent of the implementation of the java virtual machine. In particular, it uses the stack trace of an auxilliary throwable to trace back the method that was called. This involves string parsing, which might not be implementation independent.
This class can only trace methods that are public and are not overloaded.
| Nested Class Summary | |
|---|---|
static class |
ExecutingMethod.Test
Test class. |
static class |
ExecutingMethod.Trace
Second test. |
| Field Summary | |
|---|---|
private static int |
DEFDEPTH
Default depth. |
private static int |
DEFTRACE
Default depth. |
private static long |
ms
Time. |
| Constructor Summary | |
|---|---|
ExecutingMethod()
|
|
| Method Summary | |
|---|---|
static StackTraceElement |
getExecuting(int depth)
Stack traces are available from 1.4 |
static Method |
getMethod()
Returns the method from where this method was called. |
static Method |
getMethod(int depth)
Traces through a stack track generated just to allow parsing of the calling class and method. |
static void |
printAllThreadTraces()
Gets the stack traces of all currently active threads and issuss them to std-err. |
static void |
printCurrentThreadTrace()
Prints the stack trace of the current thread. |
private static void |
printSingleThreadTrace(Thread exe,
StackTraceElement[] cur)
Takes a thread and all its thread stack trace elements and puts them in a readable form to std-err. |
static void |
printThreadTrace(Thread t)
Prints the stack trace of the specialized thread. |
static void |
printTrace()
Print the class, method and line number of the caller. |
static void |
threadDebug(long ms)
Starts a thread that waits the specified number of milliseconds and then calls the thread stack trace. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int DEFDEPTH
private static final int DEFTRACE
private static long ms
| Constructor Detail |
|---|
public ExecutingMethod()
| Method Detail |
|---|
public static Method getMethod()
public static Method getMethod(int depth)
*atclassname.method(* . If a class and methodname was
parsed, the class loader is asked if it knows the class. All of the
methods are queried for the first one that matches the parsed name. This
method is returned.
public static StackTraceElement getExecuting(int depth)
public static void printTrace()
public static void printAllThreadTraces()
public static void printThreadTrace(Thread t)
public static void printCurrentThreadTrace()
private static void printSingleThreadTrace(Thread exe,
StackTraceElement[] cur)
public static void threadDebug(long ms)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||