Class Cleanup.CollectionCloseTask

java.lang.Object
de.aristaflow.adept2.util.CleanupTask.AbstractCleanupTask<Exception>
de.aristaflow.adept2.util.Cleanup.CollectionCloseTask
All Implemented Interfaces:
CleanupTask<Exception>
Enclosing class:
Cleanup<EX extends Exception>

@Deprecated(since="17.0.0", forRemoval=true) public static final class Cleanup.CollectionCloseTask extends CleanupTask.AbstractCleanupTask<Exception>
Deprecated, for removal: This API element is subject to removal in a future version.
A cleanup task for cleaning up a collection of objects possibly being AutoCloseable. No cleanup will occur for objects which do not implement AutoCloseable.
  • Field Details

    • coll

      protected final Collection<?> coll
      Deprecated, for removal: This API element is subject to removal in a future version.
      The collection of which to close its elements which implement AutoCloseable.
  • Constructor Details

    • CollectionCloseTask

      public CollectionCloseTask(String descriptor, Collection<?> coll)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new Cleanup.CollectionCloseTask for the designated Collection and the designated descriptor using Cleanup's default logger.
      Parameters:
      descriptor - A string that meaningfully describes this task when used for logging etc. or null.
      coll - The collection of which to AutoCloseable.close() the elements.
    • CollectionCloseTask

      public CollectionCloseTask(String descriptor, Logger logger, Collection<?> coll)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new Cleanup.CollectionCloseTask for the designated Collection, the designated descriptor and the designated logger.
      Parameters:
      descriptor - A string that meaningfully describes this task when used for logging etc. or null.
      logger - The logger for messages and/or problems, e. g. unexpected exceptions.
      coll - The collection of which to AutoCloseable.close() the elements.
    • CollectionCloseTask

      public CollectionCloseTask(String descriptor, Logger logger, Collection<?> coll, Function<? super AutoCloseable,AutoCloseable> conversion)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new Cleanup.CollectionCloseTask for the designated Collection, the designated conversion applied to the collection elements before closing them, the designated descriptor and the designated logger.
      Parameters:
      descriptor - A string that meaningfully describes this task when used for logging etc. or null.
      logger - The logger for messages and/or problems, e. g. unexpected exceptions.
      coll - The collection of which to AutoCloseable.close() the elements.
      conversion - A function to convert the collection elements before closing. This allows to handler instances that are wrapped by a close ignoring wrapper. This may be null.
  • Method Details

    • cleanup

      public void cleanup(boolean explicit) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      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