YARN-6778. In ResourceWeights, weights and setWeights() should be final. (Daniel Templeton via Yufei Gu)

This commit is contained in:
Yufei Gu 2017-07-18 16:38:07 -07:00
parent 5aa2bf231f
commit daaf530fce
1 changed files with 2 additions and 2 deletions

View File

@ -27,7 +27,7 @@ import org.apache.hadoop.util.StringUtils;
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 class ResourceWeights {
public ResourceWeights() { }
public void setWeight(float weight) {
public final void setWeight(float weight) {
for (int i = 0; i < weights.length; i++) {
weights[i] = weight;
}