Package org.apache.drill.common
Class AutoCloseables
java.lang.Object
org.apache.drill.common.AutoCloseables
Utilities for AutoCloseable classes.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic AutoCloseable
all
(Collection<? extends AutoCloseable> autoCloseables) static void
close
(AutoCloseable... autoCloseables) Closes all autoCloseables if not null and suppresses subsequent exceptions if more than onestatic void
close
(Iterable<? extends AutoCloseable> autoCloseables) Closes all autoCloseables if not null and suppresses subsequent exceptions if more than onestatic void
close
(Throwable t, AutoCloseable... autoCloseables) Closes all autoCloseables if not null and suppresses exceptions by adding them to tstatic void
close
(Throwable t, Collection<? extends AutoCloseable> autoCloseables) Closes all autoCloseables if not null and suppresses exceptions by adding them to tstatic void
closeSilently
(AutoCloseable... closeables) Close all without caring about thrown exceptionsstatic void
closeWithUserException
(AutoCloseable... autoCloseables)
-
Constructor Details
-
AutoCloseables
public AutoCloseables()
-
-
Method Details
-
all
-
close
Closes all autoCloseables if not null and suppresses exceptions by adding them to t- Parameters:
t
- the throwable to add suppressed exception toautoCloseables
- the closeables to close
-
close
Closes all autoCloseables if not null and suppresses exceptions by adding them to t- Parameters:
t
- the throwable to add suppressed exception toautoCloseables
- the closeables to close
-
close
Closes all autoCloseables if not null and suppresses subsequent exceptions if more than one- Parameters:
autoCloseables
- the closeables to close- Throws:
Exception
-
closeWithUserException
-
close
Closes all autoCloseables if not null and suppresses subsequent exceptions if more than one- Parameters:
autoCloseables
- the closeables to close- Throws:
Exception
-
closeSilently
Close all without caring about thrown exceptions- Parameters:
closeables
- array containing auto closeables
-