dongjoon-hyun commented on code in PR #46131:
URL: https://github.com/apache/spark/pull/46131#discussion_r1575409704
##########
core/src/main/scala/org/apache/spark/storage/DiskBlockObjectWriter.scala:
##########
@@ -174,23 +174,46 @@ private[spark] class DiskBlockObjectWriter(
* Should call after committing or reverting partial writes.
*/
private def closeResources(): Unit = {
- if (initialized) {
- Utils.tryWithSafeFinally {
- mcs.manualClose()
- } {
- channel = null
- mcs = null
- bs = null
- fos = null
- ts = null
- objOut = null
- initialized = false
- streamOpen = false
- hasBeenClosed = true
+ try {
+ if (streamOpen) {
+ Utils.tryWithSafeFinally {
+ objOut = closeIfNonNull(objOut)
+ bs = null
+ } {
+ bs = closeIfNonNull(bs)
+ }
+ }
+ } catch {
+ case e: IOException =>
+ logError(log"Exception occurred while closing the output stream" +
+ log"${MDC(ERROR, e.getMessage)}")
+ } finally {
+ if (initialized) {
+ Utils.tryWithSafeFinally {
+ mcs.manualClose()
+ } {
+ channel = null
+ mcs = null
+ bs = null
+ fos = null
+ ts = null
+ objOut = null
+ initialized = false
+ streamOpen = false
+ hasBeenClosed = true
+ }
}
}
}
+
Review Comment:
nit. Redundant empty line. Please remove this.
--
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]