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

This commit is contained in:
bibinchundatt 2017-11-18 19:25:29 +05:30
parent 96e6a99360
commit b5b81a4f08
1 changed files with 31 additions and 27 deletions

View File

@ -1641,7 +1641,8 @@ public RMAppMetrics getRMAppMetrics() {
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 =
@ -1671,6 +1672,9 @@ public RMAppMetrics getRMAppMetrics() {
}
}
}
} finally {
this.readLock.unlock();
}
return new RMAppMetrics(resourcePreempted, numNonAMContainerPreempted,
numAMContainerPreempted, resourceSecondsMap, preemptedSecondsMap);