Class CleanupCallable<V>
java.lang.Object
de.aristaflow.adept2.util.threading.CleanupCallable<V>
- Type Parameters:
V- the result type of methodcall.
- All Implemented Interfaces:
Callable<V>
A cleanup callable executes a callable and afterwards a special cleanup
consuming runnable finally after the first callable. Problems occurring in
the cleanup will be logged to the designated logger. This way exceptions from
the first callable will not be swallowed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe callable executed normally.protected final ConsumingRunnable<V,Throwable> The cleanup runnable executed after the normal execution has terminated.protected final LoggerThe logger for logging exceptions from the cleanup runnable. -
Constructor Summary
ConstructorsConstructorDescriptionCleanupCallable(Callable<V> callable, ConsumingRunnable<V, Throwable> cleanup, Logger logger) Creates a new cleanup runnable executing the callable and the cleanup runnable finally after the callable. -
Method Summary
-
Field Details
-
callable
The callable executed normally. -
cleanup
The cleanup runnable executed after the normal execution has terminated. -
logger
The logger for logging exceptions from the cleanup runnable.
-
-
Constructor Details
-
CleanupCallable
Creates a new cleanup runnable executing the callable and the cleanup runnable finally after the callable. Problems occurring in the cleanup will be logged to the designated logger.- Parameters:
callable- The callable executed normally.cleanup- The cleanup runnable executed after the normal execution has terminated.logger- The logger for logging exceptions from the cleanup.
-
-
Method Details