YARN-7489. ConcurrentModificationException in RMAppImpl#getRMAppMetrics. Contributed by Tao Yang.

(cherry picked from commit b5b81a4f08)
This commit is contained in:
bibinchundatt 2017-11-18 19:25:29 +05:30
parent ae8d1b3c34
commit fbcadfe3c4
1 changed files with 31 additions and 27 deletions

View File

@ -1611,7 +1611,8 @@ public class RMAppImpl implements RMApp, Recoverable {
int numNonAMContainerPreempted = 0;
Map<String, Long> resourceSecondsMap = new HashMap<>();
Map<String, Long> preemptedSecondsMap = new HashMap<>();
this.readLock.lock();
try {
for (RMAppAttempt attempt : attempts.values()) {
if (null != attempt) {
RMAppAttemptMetrics attemptMetrics =
@ -1641,6 +1642,9 @@ public class RMAppImpl implements RMApp, Recoverable {
}
}
}
} finally {
this.readLock.unlock();
}
return new RMAppMetrics(resourcePreempted, numNonAMContainerPreempted,
numAMContainerPreempted, resourceSecondsMap, preemptedSecondsMap);