YARN-1692. ConcurrentModificationException in fair scheduler AppSchedulable (Sangjin Lee via Sandy Ryza)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1567788 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sanford Ryza 2014-02-12 23:04:42 +00:00
parent ad6bc868b6
commit bc939f7ae6
4 changed files with 13 additions and 8 deletions

View File

@ -268,6 +268,9 @@ Release 2.3.1 - UNRELEASED
BUG FIXES
YARN-1692. ConcurrentModificationException in fair scheduler AppSchedulable
(Sangjin Lee via Sandy Ryza)
Release 2.3.0 - 2014-02-18
INCOMPATIBLE CHANGES

View File

@ -150,7 +150,7 @@ public class SchedulerApplicationAttempt {
return appSchedulingInfo.getPriorities();
}
public ResourceRequest getResourceRequest(Priority priority, String resourceName) {
public synchronized ResourceRequest getResourceRequest(Priority priority, String resourceName) {
return this.appSchedulingInfo.getResourceRequest(priority, resourceName);
}
@ -158,7 +158,7 @@ public class SchedulerApplicationAttempt {
return getResourceRequest(priority, ResourceRequest.ANY).getNumContainers();
}
public Resource getResource(Priority priority) {
public synchronized Resource getResource(Priority priority) {
return appSchedulingInfo.getResource(priority);
}

View File

@ -192,7 +192,7 @@ public class FiCaSchedulerApp extends SchedulerApplicationAttempt {
return Math.min(((float)requiredResources / clusterNodes), 1.0f);
}
public Resource getTotalPendingRequests() {
public synchronized Resource getTotalPendingRequests() {
Resource ret = Resource.newInstance(0, 0);
for (ResourceRequest rr : appSchedulingInfo.getAllResourceRequests()) {
// to avoid double counting we count only "ANY" resource requests

View File

@ -82,6 +82,7 @@ public class AppSchedulable extends Schedulable {
Resources.addTo(demand, app.getCurrentConsumption());
// Add up outstanding resource requests
synchronized (app) {
for (Priority p : app.getPriorities()) {
for (ResourceRequest r : app.getResourceRequests(p).values()) {
Resource total = Resources.multiply(r.getCapability(), r.getNumContainers());
@ -89,6 +90,7 @@ public class AppSchedulable extends Schedulable {
}
}
}
}
@Override
public Resource getDemand() {