Skip to content

Commit b430534

Browse files
author
Marcelo Vanzin
committed
Remove seemingly unnecessary synchronization.
1 parent 50eb4b9 commit b430534

File tree

1 file changed

+6
-9
lines changed
  • core/src/main/scala/org/apache/spark/deploy/worker

1 file changed

+6
-9
lines changed

core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -342,15 +342,12 @@ private[spark] class Worker(
342342
// Create local dirs for the executor. These are passed to the executor via the
343343
// SPARK_LOCAL_DIRS environment variable, and deleted by the Worker when the
344344
// application finishes.
345-
val appLocalDirs = appDirectories.synchronized {
346-
val dirs = appDirectories.get(appId).getOrElse {
347-
Utils.getOrCreateLocalRootDirs(conf).map { dir =>
348-
Utils.createDirectory(dir).getAbsolutePath()
349-
}.toSeq
350-
}
351-
appDirectories(appId) = dirs
352-
dirs
345+
val appLocalDirs = appDirectories.get(appId).getOrElse {
346+
Utils.getOrCreateLocalRootDirs(conf).map { dir =>
347+
Utils.createDirectory(dir).getAbsolutePath()
348+
}.toSeq
353349
}
350+
appDirectories(appId) = appLocalDirs
354351

355352
val manager = new ExecutorRunner(appId, execId, appDesc, cores_, memory_,
356353
self, workerId, host, sparkHome, executorDir, akkaUrl, conf, appLocalDirs,
@@ -472,7 +469,7 @@ private[spark] class Worker(
472469
registerWithMaster()
473470
}
474471

475-
private def maybeCleanupApplication(id: String): Unit = appDirectories.synchronized {
472+
private def maybeCleanupApplication(id: String): Unit = {
476473
val shouldCleanup = finishedApps.contains(id) && !executors.values.exists(_.appId == id)
477474
if (shouldCleanup) {
478475
finishedApps -= id

0 commit comments

Comments
 (0)