public abstract class ThreadTracingRunnable extends java.lang.Object implements java.lang.Runnable
A stacktrace, together with the origin thread name, is going to be "saved" at the time this
class is instantiated and appended as "cause" to whatever is thrown from the
To use this class, just extends it instead of implementing
Runnable. Then just
If the runnable is created ahead of time and used somewhere else later, a new, more relevant,
stacktrace can be created calling
If you need to chain another Runnable from your run method, you can pass the Throwable
tracedRun(ThreadTracingRunnable) to the constructor
tracedRun(ThreadTracingRunnable). Therefore, the crash can now be tracked
across boundaries of multiple threads.
|Constructor and Description|
If you are chaining multiple Runnable together that are going to schedule each other within their run() method, use this constructor to track their stacktraces across threads.
|Modifier and Type||Method and Description|
Reset the stacktrace of this Runnable to this point.
Implement here your
public ThreadTracingRunnable(ThreadTracingRunnable prevTracingRunnable)
public abstract void tracedRun(ThreadTracingRunnable prevTracingRunnable)
prevTracingRunnable- If this ThreadTracingRunnable schedule another ThreadTracingRunnable to another thread, pass this parameter to the new ThreadTracingRunnable class with
public void resetTrace()
public final void run()