YARN-7489. ConcurrentModificationException in RMAppImpl#getRMAppMetrics. Contributed by Tao Yang.
(cherry picked from commit 5c2986e58d
)
This commit is contained in:
parent
ee267565b5
commit
dc4132395e
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue