YARN-6778. In ResourceWeights, weights and setWeights() should be final. (Daniel Templeton via Yufei Gu)
(cherry picked from commit daaf530fce
)
This commit is contained in:
parent
9b961db569
commit
d04bb465d2
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue