From 59cfecd60e69c9da907b2da7ff1cda6c7178d21e Mon Sep 17 00:00:00 2001 From: Yufei Gu Date: Mon, 14 Aug 2017 11:18:08 -0700 Subject: [PATCH] YARN-6994. [YARN-3926] Remove last uses of Long from resource types code. (Daniel Templeton via Yufei Gu) (cherry picked from commit d5e9939ebb59e4f6f8e5e2fe7f619fb032f2911c) --- .../java/org/apache/hadoop/yarn/api/records/Resource.java | 4 ++-- .../hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java | 4 ++-- .../java/org/apache/hadoop/yarn/util/resource/Resources.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java index bbd4c87e550..54f0b18b51c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java @@ -273,14 +273,14 @@ public abstract class Resource implements Comparable { */ @Public @Evolving - public void setResourceValue(String resource, Long value) + public void setResourceValue(String resource, long value) throws ResourceNotFoundException { if (resource.equals(MEMORY)) { this.setMemorySize(value); return; } if (resource.equals(VCORES)) { - this.setVirtualCores(value.intValue()); + this.setVirtualCores((int)value); return; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java index 00be77acef2..2de338a13bc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java @@ -31,8 +31,8 @@ import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto; import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProtoOrBuilder; import org.apache.hadoop.yarn.proto.YarnProtos.ResourceInformationProto; -import org.apache.hadoop.yarn.util.resource.ResourceUtils; import org.apache.hadoop.yarn.util.UnitsConversionUtil; +import org.apache.hadoop.yarn.util.resource.ResourceUtils; import java.util.Arrays; import java.util.Map; @@ -174,7 +174,7 @@ public class ResourcePBImpl extends BaseResource { } @Override - public void setResourceValue(String resource, Long value) + public void setResourceValue(String resource, long value) throws ResourceNotFoundException { maybeInitBuilder(); if (resource == null) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java index f62114dfc9b..3cf78ed8c9f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java @@ -104,7 +104,7 @@ public class Resources { } @Override - public void setResourceValue(String resource, Long value) + public void setResourceValue(String resource, long value) throws ResourceNotFoundException { throw new RuntimeException(name + " cannot be modified!"); }