Skip to content

Commit

Permalink
Remove super paranoid code to close file handles
Browse files Browse the repository at this point in the history
  • Loading branch information
mateiz committed Aug 2, 2014
1 parent bda37bb commit 0374217
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -497,23 +497,9 @@ class ExternalAppendOnlyMap[K, V, C](
private def cleanup() {
batchIndex = batchOffsets.length // Prevent reading any other batch
val ds = deserializeStream
val fs = fileStream
deserializeStream = null
fileStream = null

if (ds != null) {
try {
ds.close()
} catch {
case e: IOException =>
// Make sure we at least close the file handle
if (fs != null) {
try { fs.close() } catch { case e2: IOException => }
}
throw e
}
}

ds.close()
file.delete()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,23 +618,9 @@ private[spark] class ExternalSorter[K, V, C](
def cleanup() {
batchId = batchOffsets.length // Prevent reading any other batch
val ds = deserializeStream
val fs = fileStream
deserializeStream = null
fileStream = null

if (ds != null) {
try {
ds.close()
} catch {
case e: IOException =>
// Make sure we at least close the file handle
if (fs != null) {
try { fs.close() } catch { case e2: IOException => }
}
throw e
}
}

ds.close()
// NOTE: We don't do file.delete() here because that is done in ExternalSorter.stop().
// This should also be fixed in ExternalAppendOnlyMap.
}
Expand Down

0 comments on commit 0374217

Please sign in to comment.