From d3b26454e453953d2eb221b62d1ff3632da9e8a6 Mon Sep 17 00:00:00 2001 From: Jian He Date: Wed, 7 Jan 2015 14:12:07 -0800 Subject: [PATCH] YARN-3010. Fixed findbugs warning in AbstractYarnScheduler. Contributed by Yi Liu (cherry picked from commit e13a484a2be64fb781c5eca5ae7056cbe194ac5e) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../resourcemanager/scheduler/AbstractYarnScheduler.java | 4 ++-- .../resourcemanager/scheduler/capacity/CapacityScheduler.java | 3 ++- .../server/resourcemanager/scheduler/fair/FairScheduler.java | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index c477db75642..5e8e6ca783e 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -296,6 +296,9 @@ Release 2.7.0 - UNRELEASED YARN-2230. Fixed few configs description in yarn-default.xml. (Vijay Bhat via jianhe) + YARN-3010. Fixed findbugs warning in AbstractYarnScheduler. (Yi Liu via + jianhe) + Release 2.6.0 - 2014-11-18 INCOMPATIBLE CHANGES 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/AbstractYarnScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java index bf720ae51dc..ad2b5d407c4 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java @@ -189,8 +189,8 @@ public abstract class AbstractYarnScheduler } } - protected void containerLaunchedOnNode(ContainerId containerId, - SchedulerNode node) { + protected synchronized void containerLaunchedOnNode( + ContainerId containerId, SchedulerNode node) { // Get the application for the finished container SchedulerApplicationAttempt application = getCurrentAttemptForContainer (containerId); 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 5e6a3526602..e622d3a5700 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 @@ -249,7 +249,8 @@ public class CapacityScheduler extends } @Override - public RMContainerTokenSecretManager getContainerTokenSecretManager() { + public synchronized RMContainerTokenSecretManager + getContainerTokenSecretManager() { return this.rmContext.getContainerTokenSecretManager(); } 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/FairScheduler.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/FairScheduler.java index 124da998596..2f0857e18f2 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/FairScheduler.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/FairScheduler.java @@ -1232,7 +1232,7 @@ public class FairScheduler extends } } - private String resolveReservationQueueName(String queueName, + private synchronized String resolveReservationQueueName(String queueName, ApplicationId applicationId, ReservationId reservationID) { FSQueue queue = queueMgr.getQueue(queueName); if ((queue == null) || !allocConf.isReservable(queue.getQueueName())) {