YARN-7270 addendum: Reapplied changes after YARN-3926 backports

This commit is contained in:
Daniel Templeton 2017-10-16 11:43:54 -07:00
parent 0f7786cee3
commit 0bc3c9fca2
3 changed files with 5 additions and 5 deletions

View File

@ -285,7 +285,7 @@ public abstract class Resource implements Comparable<Resource> {
return;
}
if (resource.equals(ResourceInformation.VCORES_URI)) {
this.setVirtualCores((int) resourceInformation.getValue());
this.setVirtualCores(castToIntSafely(resourceInformation.getValue()));
return;
}
ResourceInformation storedResourceInfo = getResourceInformation(resource);
@ -331,7 +331,7 @@ public abstract class Resource implements Comparable<Resource> {
return;
}
if (resource.equals(ResourceInformation.VCORES_URI)) {
this.setVirtualCores((int)value);
this.setVirtualCores(castToIntSafely(value));
return;
}

View File

@ -92,7 +92,7 @@ public class LightWeightResource extends Resource {
@Override
@SuppressWarnings("deprecation")
public int getMemory() {
return (int) memoryResInfo.getValue();
return castToIntSafely(memoryResInfo.getValue());
}
@Override
@ -113,7 +113,7 @@ public class LightWeightResource extends Resource {
@Override
public int getVirtualCores() {
return (int) vcoresResInfo.getValue();
return castToIntSafely(vcoresResInfo.getValue());
}
@Override

View File

@ -117,7 +117,7 @@ public class ResourcePBImpl extends Resource {
@Override
public int getVirtualCores() {
// vcores should always be present
return (int) resources[VCORES_INDEX].getValue();
return castToIntSafely(resources[VCORES_INDEX].getValue());
}
@Override