Skip to content

Commit 925d8b2

Browse files
committed
SPARK-1623: Use File objects instead of String's in HTTPBroadcast
This seems strictly better, and I think it's justified only the grounds of clean-up. It might also fix issues with path conversions, but I haven't yet isolated any instance of that happening. /cc @srowen @tdas Author: Patrick Wendell <[email protected]> Closes #749 from pwendell/broadcast-cleanup and squashes the following commits: d6d54f2 [Patrick Wendell] SPARK-1623: Use File objects instead of string's in HTTPBroadcast
1 parent 3ce526b commit 925d8b2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/src/main/scala/org/apache/spark/broadcast/HttpBroadcast.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private[spark] object HttpBroadcast extends Logging {
112112
private var securityManager: SecurityManager = null
113113

114114
// TODO: This shouldn't be a global variable so that multiple SparkContexts can coexist
115-
private val files = new TimeStampedHashSet[String]
115+
private val files = new TimeStampedHashSet[File]
116116
private val httpReadTimeout = TimeUnit.MILLISECONDS.convert(5, TimeUnit.MINUTES).toInt
117117
private var compressionCodec: CompressionCodec = null
118118
private var cleaner: MetadataCleaner = null
@@ -173,7 +173,7 @@ private[spark] object HttpBroadcast extends Logging {
173173
val serOut = ser.serializeStream(out)
174174
serOut.writeObject(value)
175175
serOut.close()
176-
files += file.getAbsolutePath
176+
files += file
177177
}
178178

179179
def read[T: ClassTag](id: Long): T = {
@@ -216,7 +216,7 @@ private[spark] object HttpBroadcast extends Logging {
216216
SparkEnv.get.blockManager.master.removeBroadcast(id, removeFromDriver, blocking)
217217
if (removeFromDriver) {
218218
val file = getFile(id)
219-
files.remove(file.toString)
219+
files.remove(file)
220220
deleteBroadcastFile(file)
221221
}
222222
}
@@ -232,7 +232,7 @@ private[spark] object HttpBroadcast extends Logging {
232232
val (file, time) = (entry.getKey, entry.getValue)
233233
if (time < cleanupTime) {
234234
iterator.remove()
235-
deleteBroadcastFile(new File(file.toString))
235+
deleteBroadcastFile(file)
236236
}
237237
}
238238
}

0 commit comments

Comments
 (0)