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/UsersManager.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/UsersManager.java index 7287c5b7c3b..747a488a5a5 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/UsersManager.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/UsersManager.java @@ -490,11 +490,12 @@ public class UsersManager implements AbstractUsersManager { Resource clusterResource, String nodePartition, SchedulingMode schedulingMode) { - Map userLimitPerSchedulingMode = preComputedActiveUserLimit - .get(nodePartition); + Map userLimitPerSchedulingMode; try { writeLock.lock(); + userLimitPerSchedulingMode = + preComputedActiveUserLimit.get(nodePartition); if (isRecomputeNeeded(schedulingMode, nodePartition, true)) { // recompute userLimitPerSchedulingMode = reComputeUserLimits(userName, @@ -548,11 +549,11 @@ public class UsersManager implements AbstractUsersManager { Resource clusterResource, String nodePartition, SchedulingMode schedulingMode) { - Map userLimitPerSchedulingMode = preComputedAllUserLimit - .get(nodePartition); + Map userLimitPerSchedulingMode; try { writeLock.lock(); + userLimitPerSchedulingMode = preComputedAllUserLimit.get(nodePartition); if (isRecomputeNeeded(schedulingMode, nodePartition, false)) { // recompute userLimitPerSchedulingMode = reComputeUserLimits(userName,