diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java index b14ab4059b9..60c8b672aad 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java @@ -414,9 +414,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { double currentCost = computeCost(cluster, Double.MAX_VALUE); curOverallCost = currentCost; - for (int i = 0; i < this.curFunctionCosts.length; i++) { - curFunctionCosts[i] = tempFunctionCosts[i]; - } + System.arraycopy(tempFunctionCosts, 0, curFunctionCosts, 0, this.curFunctionCosts.length); double initCost = currentCost; double newCost = currentCost; @@ -462,9 +460,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { // save for JMX curOverallCost = currentCost; - for (int i = 0; i < this.curFunctionCosts.length; i++) { - curFunctionCosts[i] = tempFunctionCosts[i]; - } + System.arraycopy(tempFunctionCosts, 0, curFunctionCosts, 0, this.curFunctionCosts.length); } else { // Put things back the way they were before. // TODO: undo by remembering old values