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.CollCloseTask, 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 by Cleanup and registered as post-mortem action for specific objects. Unlike Cleaner, 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 
    Convenient base class for CleanupTask with the option to provide a custom descriptor for the clean-up task and/or a logger.
    static final class 
    A simple cleanup task for cleaning up an AtomicReference.
    static class 
    An abstract cleanup task for closing a supplied AutoCloseable and resetting it via a Runnable.
    static final class 
    A simple cleanup task for cleaning up a Mutable.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cleanup(boolean explicit)
    Performs the actual clean-up.
    default String
    Gets a string that meaningfully describes or identifies this task when used in log message etc.
  • Method Details

    • getDescriptor

      default String getDescriptor()
      Gets a string that meaningfully describes or identifies this task when used in log message etc. When null 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
      Performs the actual clean-up. This method is only called by Cleanup and must NOT be called directly!
      Parameters:
      explicit - Whether the clean-up was triggered explicitly via Cleanup.clean(). Otherwise it was triggered implicitly as a post-mortem action by the object becoming phantom reachable.
      Throws:
      EX - the exception