YARN-9175. Null resources check in ResourceInfo for branch-3.0

(cherry picked from commit a0291a015c)
This commit is contained in:
Jonathan Hung 2019-01-03 15:58:10 -05:00
parent 4d30c90a1b
commit 078dfb09fe
1 changed files with 4 additions and 1 deletions

View File

@ -62,7 +62,7 @@ public class ResourceInfo {
@Override @Override
public String toString() { public String toString() {
return resources.toString(); return getResource().toString();
} }
public void setMemory(int memory) { public void setMemory(int memory) {
@ -82,6 +82,9 @@ public class ResourceInfo {
} }
public Resource getResource() { public Resource getResource() {
if (resources == null) {
resources = Resource.newInstance(memory, vCores);
}
return Resource.newInstance(resources); return Resource.newInstance(resources);
} }
} }