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 AutoCloseable and resetting it via a Runnable.
No cleanup will occur if the supplied value is not an AutoCloseable.
  • Field Details

    • supplier

      protected final Supplier<?> supplier
      The supplier providing an AutoCloseable which to AutoCloseable.close() or null or a different interface.
    • reset

      protected final Runnable reset
      A runnable for resetting the supplied value or null to skip resetting.
  • Method Details

    • cleanup

      public void cleanup(boolean explicit) throws Exception
      Description copied from interface: CleanupTask
      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:
      Exception