Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/565#discussion_r82263890
  
    --- Diff: common/src/main/java/org/apache/drill/common/AutoCloseables.java 
---
    @@ -87,4 +87,29 @@ public static void close(Iterable<? extends 
AutoCloseable> ac) throws Exception
           throw topLevelException;
         }
       }
    +
    +  /**
    +   * close() an {@see java.lang.AutoCloseable} without throwing a (checked)
    +   * {@see java.lang.Exception}. This wraps the close() call with a
    +   * try-catch that will rethrow an Exception wrapped with a
    +   * {@see java.lang.RuntimeException}, providing a way to call close()
    +   * without having to do the try-catch everywhere or propagate the 
Exception.
    +   *
    +   * @param autoCloseable the AutoCloseable to close; may be null
    +   * @throws RuntimeException if an Exception occurs; the Exception is
    +   *   wrapped by the RuntimeException
    +   */
    +  public static void closeNoChecked(final AutoCloseable autoCloseable) {
    --- End diff --
    
    closeUnchecked ?
    
    But, we are "checking", the "checked" has to do with the Exception type.
    
    Maybe cleanClose( ) for this function. Then, add a "closeSilently" to catch 
and ignore close exceptions. (The closeSilently is handy in the case when, say, 
a file is full, a write failed, and the close will also fail because it still 
can't flush pending buffers.) There are other functions to the to silent close, 
but might be handy to have them in one place.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to