You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/08/10 02:22:23 UTC
[GitHub] [spark] LuciferYang commented on a change in pull request #33682: [WIP][SPARK-36456][CORE][SQL][STRUCTURED STREAMING] Clean up compilation warnings related to `method closeQuietly in class IOUtils is deprecated`
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org