Class AutoCloseables

java.lang.Object
org.apache.drill.common.AutoCloseables

public class AutoCloseables extends Object
Utilities for AutoCloseable classes.
  • Constructor Details

    • AutoCloseables

      public AutoCloseables()
  • Method Details

    • all

      public static AutoCloseable all(Collection<? extends AutoCloseable> autoCloseables)
    • close

      public static void close(Throwable t, AutoCloseable... autoCloseables)
      Closes all autoCloseables if not null and suppresses exceptions by adding them to t
      Parameters:
      t - the throwable to add suppressed exception to
      autoCloseables - the closeables to close
    • close

      public static void close(Throwable t, Collection<? extends AutoCloseable> autoCloseables)
      Closes all autoCloseables if not null and suppresses exceptions by adding them to t
      Parameters:
      t - the throwable to add suppressed exception to
      autoCloseables - the closeables to close
    • close

      public static void close(AutoCloseable... autoCloseables) throws Exception
      Closes all autoCloseables if not null and suppresses subsequent exceptions if more than one
      Parameters:
      autoCloseables - the closeables to close
      Throws:
      Exception
    • closeWithUserException

      public static void closeWithUserException(AutoCloseable... autoCloseables)
    • close

      public static void close(Iterable<? extends AutoCloseable> autoCloseables) throws Exception
      Closes all autoCloseables if not null and suppresses subsequent exceptions if more than one
      Parameters:
      autoCloseables - the closeables to close
      Throws:
      Exception
    • closeSilently

      public static void closeSilently(AutoCloseable... closeables)
      Close all without caring about thrown exceptions
      Parameters:
      closeables - array containing auto closeables