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
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(Throwable) to the constructor
tracedRun(Throwable). 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(Throwable prevTracingThrowable)
public abstract void tracedRun(Throwable tracingThrowable)
tracingThrowable- If this Runnable schedule another Runnable to another thread, pass this parameter to the new ThreadTracingRunnable class with
public void resetTrace()