ThreadTracingRunnable

ThreadTracingRunnable tries to help debugging crashes happening across threads showing the stacktrace of the crash origin which scheduled this 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 run() method.

To use this class, just extends it instead of implementing Runnable. Then just implement tracedRun().

If the runnable is created ahead of time and used somewhere else later, a new, more relevant, stacktrace can be created calling resetTrace().

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard

Reset the stacktrace of this Runnable to this point. To be called right before the runnable is scheduled to another thread, in case it was instantiated ahead of time with a different code flow.

Link copied to clipboard
open override fun run()
Link copied to clipboard
abstract fun tracedRun()

Implement here your Runnable#run() code.