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