From fcfbdf64406ac44b771a3c1b91b95d9d9a465391 Mon Sep 17 00:00:00 2001 From: Karthik Kambatla Date: Thu, 12 Feb 2015 13:44:47 -0800 Subject: [PATCH] YARN-3181. FairScheduler: Fix up outdated findbugs issues. (kasha) (cherry picked from commit c2b185def846f5577a130003a533b9c377b58fab) --- hadoop-yarn-project/CHANGES.txt | 2 ++ .../dev-support/findbugs-exclude.xml | 27 ------------------- .../fair/AllocationConfiguration.java | 13 ++++++--- .../fair/AllocationFileLoaderService.java | 2 +- .../scheduler/fair/FSOpDurations.java | 3 +++ 5 files changed, 16 insertions(+), 31 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 6d27c85bf5b..87524586bf3 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -243,6 +243,8 @@ Release 2.7.0 - UNRELEASED YARN-2079. Recover NonAggregatingLogHandler state upon nodemanager restart. (Jason Lowe via junping_du) + YARN-3181. FairScheduler: Fix up outdated findbugs issues. (kasha) + YARN-3124. Fixed CS LeafQueue/ParentQueue to use QueueCapacities to track capacities-by-label. (Wangda Tan via jianhe) diff --git a/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml b/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml index c45634e1be0..70f1a71fbcb 100644 --- a/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml +++ b/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml @@ -142,22 +142,12 @@ - - - - - - - - - - @@ -215,18 +205,6 @@ - - - - - - - - - - - - @@ -426,11 +404,6 @@ - - - - - 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/fair/AllocationConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/AllocationConfiguration.java index 0ea73140302..9cb767d38a5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/AllocationConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/AllocationConfiguration.java @@ -33,6 +33,9 @@ import org.apache.hadoop.yarn.util.resource.Resources; import com.google.common.annotations.VisibleForTesting; +import javax.annotation.concurrent.ThreadSafe; + +@ThreadSafe public class AllocationConfiguration extends ReservationSchedulerConfiguration { private static final AccessControlList EVERYBODY_ACL = new AccessControlList("*"); private static final AccessControlList NOBODY_ACL = new AccessControlList(" "); @@ -204,12 +207,16 @@ public class AllocationConfiguration extends ReservationSchedulerConfiguration { } public ResourceWeights getQueueWeight(String queue) { - ResourceWeights weight = queueWeights.get(queue); - return (weight == null) ? ResourceWeights.NEUTRAL : weight; + synchronized (queueWeights) { + ResourceWeights weight = queueWeights.get(queue); + return (weight == null) ? ResourceWeights.NEUTRAL : weight; + } } public void setQueueWeight(String queue, ResourceWeights weight) { - queueWeights.put(queue, weight); + synchronized (queueWeights) { + queueWeights.put(queue, weight); + } } public int getUserMaxApps(String user) { 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/fair/AllocationFileLoaderService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/AllocationFileLoaderService.java index 76fa588fc76..c19aa513e1c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/AllocationFileLoaderService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/AllocationFileLoaderService.java @@ -201,7 +201,7 @@ public class AllocationFileLoaderService extends AbstractService { * @throws ParserConfigurationException if XML parser is misconfigured. * @throws SAXException if config file is malformed. */ - public synchronized void reloadAllocations() throws IOException, + public void reloadAllocations() throws IOException, ParserConfigurationException, SAXException, AllocationConfigurationException { if (allocFile == null) { return; 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/fair/FSOpDurations.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSOpDurations.java index c2282fdb736..c50f281cb66 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSOpDurations.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSOpDurations.java @@ -31,6 +31,8 @@ import org.apache.hadoop.metrics2.lib.MetricsRegistry; import static org.apache.hadoop.metrics2.lib.Interns.info; import org.apache.hadoop.metrics2.lib.MutableRate; +import javax.annotation.concurrent.ThreadSafe; + /** * Class to capture the performance metrics of FairScheduler. * This should be a singleton. @@ -38,6 +40,7 @@ import org.apache.hadoop.metrics2.lib.MutableRate; @InterfaceAudience.Private @InterfaceStability.Unstable @Metrics(context="fairscheduler-op-durations") +@ThreadSafe public class FSOpDurations implements MetricsSource { @Metric("Duration for a continuous scheduling run")