Class CleanupRunnable
- java.lang.Object
-
- de.aristaflow.adept2.util.threading.CleanupRunnable
-
- All Implemented Interfaces:
Runnable
public class CleanupRunnable extends Object implements Runnable
A cleanup runnable executes a runnable and afterwards a special cleanup runnable finally after the first runnable. Problems occurring in the cleanup runnable will be logged to the designated logger. This way exceptions from the first runnable will not be swallowed.- Author:
- Ulrich Kreher
-
-
Field Summary
Fields Modifier and Type Field Description protected Runnable
cleanup
The cleanup runnable executed after the normal execution has terminated.protected Logger
logger
The logger for logging exceptions from the cleanup runnable.protected Runnable
runnable
The runnable executed normally.
-
Constructor Summary
Constructors Constructor Description CleanupRunnable(Runnable runnable, Runnable cleanup, Logger logger)
Creates a new cleanup runnable executing the first runnable and the cleanup runnable finally after the first runnable.
-
-
-
Constructor Detail
-
CleanupRunnable
public CleanupRunnable(Runnable runnable, Runnable cleanup, Logger logger)
Creates a new cleanup runnable executing the first runnable and the cleanup runnable finally after the first runnable. Problems occurring in the cleanup runnable will be logged to the designated logger.- Parameters:
runnable
- The runnable executed normally.cleanup
- The cleanup runnable executed after the normal execution has terminated.logger
- The logger for logging exceptions from the cleanup runnable.
-
-