YARN-6778. In ResourceWeights, weights and setWeights() should be final. (Daniel Templeton via Yufei Gu)
This commit is contained in:
parent
5aa2bf231f
commit
daaf530fce
|
@ -27,7 +27,7 @@ import org.apache.hadoop.util.StringUtils;
|
||||||
public class ResourceWeights {
|
public class ResourceWeights {
|
||||||
public static final ResourceWeights NEUTRAL = new ResourceWeights(1.0f);
|
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) {
|
public ResourceWeights(float memoryWeight, float cpuWeight) {
|
||||||
weights[ResourceType.MEMORY.ordinal()] = memoryWeight;
|
weights[ResourceType.MEMORY.ordinal()] = memoryWeight;
|
||||||
|
@ -40,7 +40,7 @@ public class ResourceWeights {
|
||||||
|
|
||||||
public ResourceWeights() { }
|
public ResourceWeights() { }
|
||||||
|
|
||||||
public void setWeight(float weight) {
|
public final void setWeight(float weight) {
|
||||||
for (int i = 0; i < weights.length; i++) {
|
for (int i = 0; i < weights.length; i++) {
|
||||||
weights[i] = weight;
|
weights[i] = weight;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue