From 3316cd4357ff6ccc4c76584813092adb1c2b4d43 Mon Sep 17 00:00:00 2001 From: Wangda Tan Date: Fri, 17 Apr 2015 17:22:27 -0700 Subject: [PATCH] YARN-3487. CapacityScheduler scheduler lock obtained unnecessarily when calling getQueue (Jason Lowe via wangda) (cherry picked from commit f47a5763acd55cb0b3f16152c7f8df06ec0e09a9) --- hadoop-yarn-project/CHANGES.txt | 2 ++ .../scheduler/capacity/CapacityScheduler.java | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 209fc60715c..bd5439b56c1 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -190,6 +190,8 @@ Release 2.7.1 - UNRELEASED OPTIMIZATIONS BUG FIXES + YARN-3487. CapacityScheduler scheduler lock obtained unnecessarily when + calling getQueue (Jason Lowe via wangda) YARN-3462. Patches applied for YARN-2424 are inconsistent between trunk and branch-2. (Naganarasimha G R via harsh) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java index 5d58b153953..1e1623d7393 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java @@ -642,7 +642,7 @@ public class CapacityScheduler extends return queue; } - public synchronized CSQueue getQueue(String queueName) { + public CSQueue getQueue(String queueName) { if (queueName == null) { return null; } @@ -940,11 +940,7 @@ public class CapacityScheduler extends boolean includeChildQueues, boolean recursive) throws IOException { CSQueue queue = null; - - synchronized (this) { - queue = this.queues.get(queueName); - } - + queue = this.queues.get(queueName); if (queue == null) { throw new IOException("Unknown queue: " + queueName); }