Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11450#discussion_r54801790
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -1267,6 +1267,45 @@ private[spark] object Utils extends Logging {
         }
       }
     
    +  /**
    +   * Execute a block of code, call the failure callbacks before finally 
block if there is any
    +   * exceptions happen. But if exceptions happen in the finally block, do 
not suppress the original
    +   * exception.
    +   *
    +   * This is primarily an issue with `finally { out.close() }` blocks, 
where
    +   * close needs to be called to clean up `out`, but if an exception 
happened
    +   * in `out.write`, it's likely `out` may be corrupted and `out.close` 
will
    +   * fail as well. This would then suppress the original/likely more 
meaningful
    +   * exception from the original `out.write` call.
    +   */
    +  def tryWithSafeFinallyAndFailureCallbacks[T](block: => T)(finallyBlock: 
=> Unit): T = {
    +    // It would be nice to find a method on Try that did this
    --- End diff --
    
    remove this comment


---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to