aboutsummaryrefslogtreecommitdiff
path: root/yarn
diff options
context:
space:
mode:
authorSandy Ryza <sandy@cloudera.com>2015-01-22 13:49:35 -0600
committerThomas Graves <tgraves@apache.org>2015-01-22 13:49:35 -0600
commit820ce03597350257abe0c5c96435c555038e3e6c (patch)
tree11aa16014fec9c7869ed0e0e49e7b15ae19783ca /yarn
parent246111d179a2f3f6b97a5c2b121d8ddbfd1c9aad (diff)
downloadspark-820ce03597350257abe0c5c96435c555038e3e6c.tar.gz
spark-820ce03597350257abe0c5c96435c555038e3e6c.tar.bz2
spark-820ce03597350257abe0c5c96435c555038e3e6c.zip
SPARK-5370. [YARN] Remove some unnecessary synchronization in YarnAlloca...
...tor Author: Sandy Ryza <sandy@cloudera.com> Closes #4164 from sryza/sandy-spark-5370 and squashes the following commits: 0c8d736 [Sandy Ryza] SPARK-5370. [YARN] Remove some unnecessary synchronization in YarnAllocator
Diffstat (limited to 'yarn')
-rw-r--r--yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala23
1 files changed, 10 insertions, 13 deletions
diff --git a/yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala b/yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala
index 4c35b60c57..d00f29665a 100644
--- a/yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala
+++ b/yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala
@@ -60,7 +60,6 @@ private[yarn] class YarnAllocator(
import YarnAllocator._
- // These two complementary data structures are locked on allocatedHostToContainersMap.
// Visible for testing.
val allocatedHostToContainersMap =
new HashMap[String, collection.mutable.Set[ContainerId]]
@@ -355,20 +354,18 @@ private[yarn] class YarnAllocator(
}
}
- allocatedHostToContainersMap.synchronized {
- if (allocatedContainerToHostMap.containsKey(containerId)) {
- val host = allocatedContainerToHostMap.get(containerId).get
- val containerSet = allocatedHostToContainersMap.get(host).get
+ if (allocatedContainerToHostMap.containsKey(containerId)) {
+ val host = allocatedContainerToHostMap.get(containerId).get
+ val containerSet = allocatedHostToContainersMap.get(host).get
- containerSet.remove(containerId)
- if (containerSet.isEmpty) {
- allocatedHostToContainersMap.remove(host)
- } else {
- allocatedHostToContainersMap.update(host, containerSet)
- }
-
- allocatedContainerToHostMap.remove(containerId)
+ containerSet.remove(containerId)
+ if (containerSet.isEmpty) {
+ allocatedHostToContainersMap.remove(host)
+ } else {
+ allocatedHostToContainersMap.update(host, containerSet)
}
+
+ allocatedContainerToHostMap.remove(containerId)
}
}
}