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 suppliedAutoCloseableand resetting it via aRunnable.
No cleanup will occur if the supplied value is not anAutoCloseable.
-
-
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
Fields Modifier and Type Field Description protected RunnableresetA runnable for resetting the supplied value ornullto skip resetting.protected Supplier<?>supplierThe supplier providing anAutoCloseablewhich toAutoCloseable.close()ornullor a different interface.-
Fields inherited from class de.aristaflow.adept2.util.CleanupTask.AbstractCleanupTask
descriptor, logger
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup(boolean explicit)Performs the actual clean-up.-
Methods inherited from class de.aristaflow.adept2.util.CleanupTask.AbstractCleanupTask
getDescriptor
-
-
-
-
Field Detail
-
supplier
protected final Supplier<?> supplier
The supplier providing anAutoCloseablewhich toAutoCloseable.close()ornullor a different interface.
-
reset
protected final Runnable reset
A runnable for resetting the supplied value ornullto skip resetting.
-
-
Method Detail
-
cleanup
public void cleanup(boolean explicit) throws ExceptionDescription 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
-
-