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 void
closeNoChecked
(AutoCloseable autoCloseable) close() anAutoCloseable
without throwing a (checked)Exception
.
-
Method Details
-
closeNoChecked
close() anAutoCloseable
without 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
-