YARN-786: Addendum so that RMAppAttemptImpl#getApplicationResourceUsageReport won't return null

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1543597 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sanford Ryza 2013-11-19 22:22:00 +00:00
parent d9ba056bdb
commit c78c0e277f

View File

@ -53,6 +53,7 @@
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.Priority;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.factories.RecordFactory;
@ -653,7 +654,14 @@ public void handle(RMAppAttemptEvent event) {
public ApplicationResourceUsageReport getApplicationResourceUsageReport() {
this.readLock.lock();
try {
return scheduler.getAppResourceUsageReport(this.getAppAttemptId());
ApplicationResourceUsageReport report =
scheduler.getAppResourceUsageReport(this.getAppAttemptId());
if (report == null) {
Resource none = Resource.newInstance(0, 0);
report = ApplicationResourceUsageReport.newInstance(0, 0, none, none,
none);
}
return report;
} finally {
this.readLock.unlock();
}