public class ExceptionLoggingRunnable
extends java.lang.Object
implements java.lang.Runnable
| Modifier and Type | Field and Description |
|---|---|
protected java.util.logging.Logger |
logger
The logger with which to log an exception.
|
protected boolean |
rethrow
Whether to rethrow an occurred runtime exception or virtual machine error.
|
protected java.lang.Runnable |
runnable
The wrapped runnable.
|
| Constructor and Description |
|---|
ExceptionLoggingRunnable(java.lang.Runnable runnable,
boolean rethrow,
java.util.logging.Logger logger)
Wraps the designated runnable to catch and log runtime exceptions and virtual machine errors to
the designated logger and optionally rethrowing the runtime exception/virtual machine error.
|
| Modifier and Type | Method and Description |
|---|---|
void |
run() |
protected final java.lang.Runnable runnable
protected final boolean rethrow
protected final java.util.logging.Logger logger
public ExceptionLoggingRunnable(java.lang.Runnable runnable,
boolean rethrow,
java.util.logging.Logger logger)
runnable - The wrapped runnable.rethrow - Whether to rethrow an occurred runtime exception or virtual machine error.logger - The logger with which to log an exception.