public class ThrowableHolder extends Object
per Thread
.Modifier and Type | Field and Description |
---|---|
private static ThreadLocal<Throwable> |
caughtThrowable
The container for the most recently caught throwable.
|
Constructor and Description |
---|
ThrowableHolder() |
Modifier and Type | Method and Description |
---|---|
static <E extends Throwable> |
get() |
static <E extends Throwable> |
set(E caughtThrowable)
Saves the given throwable in
caughtThrowable . |
private static final ThreadLocal<Throwable> caughtThrowable
There is no need to use weak references
here as all
the code is for testing so that we don't have to care about memory leaks.
public ThrowableHolder()
public static <E extends Throwable> void set(E caughtThrowable)
caughtThrowable
.E
- the type of the caught throwablecaughtThrowable
- the caught throwableCopyright © 2014. All rights reserved.