From daaf530fce4b91cf9f568b9b0c5e8b20e6774134 Mon Sep 17 00:00:00 2001 From: Yufei Gu Date: Tue, 18 Jul 2017 16:38:07 -0700 Subject: [PATCH] YARN-6778. In ResourceWeights, weights and setWeights() should be final. (Daniel Templeton via Yufei Gu) --- .../yarn/server/resourcemanager/resource/ResourceWeights.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resource/ResourceWeights.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resource/ResourceWeights.java index 4c62318e6f..3ce15170eb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resource/ResourceWeights.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resource/ResourceWeights.java @@ -27,7 +27,7 @@ public class ResourceWeights { public static final ResourceWeights NEUTRAL = new ResourceWeights(1.0f); - private float[] weights = new float[ResourceType.values().length]; + private final float[] weights = new float[ResourceType.values().length]; public ResourceWeights(float memoryWeight, float cpuWeight) { weights[ResourceType.MEMORY.ordinal()] = memoryWeight; @@ -40,7 +40,7 @@ public ResourceWeights(float weight) { public ResourceWeights() { } - public void setWeight(float weight) { + public final void setWeight(float weight) { for (int i = 0; i < weights.length; i++) { weights[i] = weight; }