Package de.aristaflow.adept2.util
Class CleanupTask.CloseAndResetTask
java.lang.Object
de.aristaflow.adept2.util.CleanupTask.AbstractCleanupTask<Exception>
de.aristaflow.adept2.util.CleanupTask.CloseAndResetTask
- All Implemented Interfaces:
CleanupTask<Exception>
- Direct Known Subclasses:
CleanupTask.AtomicCloseTask,CleanupTask.MutableCloseTask
- Enclosing interface:
- CleanupTask<EX extends Exception>
public abstract static class CleanupTask.CloseAndResetTask
extends CleanupTask.AbstractCleanupTask<Exception>
An abstract cleanup task for closing a supplied
No cleanup will occur if the supplied value is not an
AutoCloseable and resetting it via
a Runnable. No cleanup will occur if the supplied value is not an
AutoCloseable.-
Nested Class Summary
Nested classes/interfaces inherited from interface de.aristaflow.adept2.util.CleanupTask
CleanupTask.AbstractCleanupTask<EX extends Exception>, CleanupTask.AtomicCloseTask, CleanupTask.CloseAndResetTask, CleanupTask.MutableCloseTask -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final RunnableA runnable for resetting the supplied value ornullto skip resetting.protected final Supplier<?>The supplier providing anAutoCloseablewhich toAutoCloseable.close()ornullor a different interface.Fields inherited from class de.aristaflow.adept2.util.CleanupTask.AbstractCleanupTask
descriptor, logger -
Method Summary
Methods inherited from class de.aristaflow.adept2.util.CleanupTask.AbstractCleanupTask
getDescriptor
-
Field Details
-
supplier
The supplier providing anAutoCloseablewhich toAutoCloseable.close()ornullor a different interface. -
reset
A runnable for resetting the supplied value ornullto skip resetting.
-
-
Method Details
-
cleanup
Description copied from interface:CleanupTaskPerforms the actual clean-up. This method is only called byCleanupand must NOT be called directly!- Parameters:
explicit- Whether the clean-up was triggered explicitly viaCleanup.clean(). Otherwise it was triggered implicitly as a post-mortem action by the object becoming phantom reachable.- Throws:
Exception
-