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

(cherry picked from commit 5c2986e58d)
This commit is contained in:
bibinchundatt 2017-11-20 21:31:50 +05:30
parent ee267565b5
commit dc4132395e
1 changed files with 22 additions and 17 deletions

View File

@ -1616,6 +1616,8 @@ public class RMAppImpl implements RMApp, Recoverable {
long vcoreSeconds = 0;
long preemptedMemorySeconds = 0;
long preemptedVcoreSeconds = 0;
this.readLock.lock();
try {
for (RMAppAttempt attempt : attempts.values()) {
if (null != attempt) {
RMAppAttemptMetrics attemptMetrics =
@ -1635,6 +1637,9 @@ public class RMAppImpl implements RMApp, Recoverable {
preemptedVcoreSeconds += attemptMetrics.getPreemptedVcore();
}
}
} finally {
this.readLock.unlock();
}
return new RMAppMetrics(resourcePreempted,
numNonAMContainerPreempted, numAMContainerPreempted,