Package de.aristaflow.adept2.util
Interface CleanupTask<EX extends Exception>
-
- Type Parameters:
EX
- The type of the checked exception thrown by the cleanup task.
- All Known Implementing Classes:
AbstractHTMLContext.HtmlContextCleanupTask
,BufferedRereadableContent.BrcCleanup
,CachingIncWorklistUpdate.CachingIncWorklistUpdateCloseTask
,CachingRemoteIterator.CachingRemoteIteratorCloseTask
,Cleanup.CollectionCloseTask
,CleanupTask.AbstractCleanupTask
,CleanupTask.AtomicCloseTask
,CleanupTask.CloseAndResetTask
,CleanupTask.MutableCloseTask
,LoggingFuture.IgnoredResultLogger
,MemoryResultSetImpl.MrsiCleanup
,RereadableContent.RrcCleanup
,RereadableContentBuilder.RcbCleanup
,ResultSetRemoteIterator.ResultSetRemoteIteratorCloseTask
,SwtHtmlContext.BrowserCloseTask
,SwtUrlContext.BrowserCloseTask
,TransformingRemoteIterator.TransformingRemoteIteratorCloseTask
public interface CleanupTask<EX extends Exception>
This interface provides the means for clean-up logic as normal or as post-mortem action. It is being used byCleanup
and registered as post-mortem action for specific objects. UnlikeCleaner
, this allows for checked exceptions which are sensible for normal cleanup actions, e. g.Closeable.close()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
CleanupTask.AbstractCleanupTask<EX extends Exception>
Convenient base class forCleanupTask
with the option to provide a custom descriptor for the clean-up task and/or a logger.static class
CleanupTask.AtomicCloseTask
A simple cleanup task for cleaning up anAtomicReference
.static class
CleanupTask.CloseAndResetTask
An abstract cleanup task for closing a suppliedAutoCloseable
and resetting it via aRunnable
.static class
CleanupTask.MutableCloseTask
A simple cleanup task for cleaning up aMutable
.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
cleanup(boolean explicit)
Performs the actual clean-up.default String
getDescriptor()
Gets a string that meaningfully describes or identifies this task when used in log message etc.
-
-
-
Method Detail
-
getDescriptor
default String getDescriptor()
Gets a string that meaningfully describes or identifies this task when used in log message etc. Whennull
is returned a descriptor will be automatically determined using#toString()
.- Returns:
- A string that meaningfully describes this task when used for logging etc. or
null
.
-
cleanup
void cleanup(boolean explicit) throws EX extends Exception
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:
EX
- the exceptionEX extends Exception
-
-