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