Class DrillAutoCloseables

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

public class DrillAutoCloseables extends Object
Provides functionality comparable to Guava's Closeables for AutoCloseables.
  • Method Details

    • closeNoChecked

      public static void closeNoChecked(AutoCloseable autoCloseable)
      close() an AutoCloseable without throwing a (checked) Exception. This wraps the close() call with a try-catch that will rethrow an Exception wrapped with a RuntimeException, providing a way to call close() without having to do the try-catch everywhere or propagate the Exception.
      Parameters:
      autoCloseable - the AutoCloseable to close; may be null
      Throws:
      RuntimeException - if an Exception occurs; the Exception is wrapped by the RuntimeException