public class ExceptionHolder extends Object
per Thread
.Modifier and Type | Field and Description |
---|---|
private static ThreadLocal<Exception> |
caughtException
The container for the most recently caught exception.
|
Constructor and Description |
---|
ExceptionHolder() |
Modifier and Type | Method and Description |
---|---|
static <E extends Exception> |
get() |
static <E extends Exception> |
set(E caughtException)
Saves the given exception in
caughtException . |
private static final ThreadLocal<Exception> caughtException
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 ExceptionHolder()
public static <E extends Exception> void set(E caughtException)
caughtException
.E
- the type of the caught exceptioncaughtException
- the caught exceptionCopyright © 2014. All rights reserved.