LuciferYang commented on a change in pull request #33682:
URL: https://github.com/apache/spark/pull/33682#discussion_r685642539



##########
File path: core/src/main/scala/org/apache/spark/util/Utils.scala
##########
@@ -2657,6 +2657,24 @@ private[spark] object Utils extends Logging {
     try f.apply(resource) finally resource.close()
   }
 
+  /**
+   * Closes the given Closeable as a null-safe operation while consuming 
IOException
+   * by the given consumer.
+   *
+   * @param closeable The resource to close, may be null.
+   * @param consumer Consumes the IOException thrown by Closeable#close().
+   */
+  def closeQuietly(closeable: Closeable, consumer: IOException => Unit = 
null): Unit = {

Review comment:
       The logic is the same, but `IOUtils.closeQuietly ` has been identified 
as `@Deprecated `.
   
   And I found a similar method encapsulation in 
`o.a.s.network.util.JavaUtils.java`, should we reuse it?
   
   
https://github.com/apache/spark/blob/c040593fb432f75f7e22e3d32a6979142a125375/common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java#L50-L58




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to