Package org.apache.drill.common
Class DrillAutoCloseables
java.lang.Object
org.apache.drill.common.DrillAutoCloseables
Provides functionality comparable to Guava's Closeables for AutoCloseables.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseNoChecked(AutoCloseable autoCloseable) close() anAutoCloseablewithout throwing a (checked)Exception.
-
Method Details
-
closeNoChecked
close() anAutoCloseablewithout throwing a (checked)Exception. This wraps the close() call with a try-catch that will rethrow an Exception wrapped with aRuntimeException, 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
-