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 suppliedAutoCloseable
and 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 Runnable
reset
A runnable for resetting the supplied value ornull
to skip resetting.protected Supplier<?>
supplier
The supplier providing anAutoCloseable
which toAutoCloseable.close()
ornull
or 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 void
cleanup(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 anAutoCloseable
which toAutoCloseable.close()
ornull
or a different interface.
-
reset
protected final Runnable reset
A runnable for resetting the supplied value ornull
to skip resetting.
-
-
Method Detail
-
cleanup
public void cleanup(boolean explicit) throws Exception
Description copied from interface:CleanupTask
Performs the actual clean-up. This method is only called byCleanup
and 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
-
-