Class ExceptionLoggingRunnable
- java.lang.Object
-
- de.aristaflow.adept2.util.threading.ExceptionLoggingRunnable
-
-
Constructor Summary
Constructors Constructor Description ExceptionLoggingRunnable(Runnable runnable, boolean rethrow, 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.
-
-
-
Field Detail
-
runnable
protected final Runnable runnable
The wrapped runnable.
-
rethrow
protected final boolean rethrow
Whether to rethrow an occurred runtime exception or virtual machine error. In case of a scheduled runnable, rethrowing will stop further executions.
-
logger
protected final Logger logger
The logger with which to log an exception.
-
-
Constructor Detail
-
ExceptionLoggingRunnable
public ExceptionLoggingRunnable(Runnable runnable, boolean rethrow, 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. In case of a scheduled runnable, rethrowing will stop further executions.- Parameters:
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.
-
-