From 5cc0714840bf8f7797a118e4bac5dabdd20e3f67 Mon Sep 17 00:00:00 2001 From: tedyu Date: Tue, 2 Dec 2014 04:43:34 -0800 Subject: [PATCH] HBASE-12559 Addendum fixes findbugs warnings --- .../hbase/master/balancer/StochasticLoadBalancer.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 bc60e8f8a72..9d8c7cb20cc 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 @@ -185,7 +185,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { } @Override - public void setClusterStatus(ClusterStatus st) { + public synchronized void setClusterStatus(ClusterStatus st) { super.setClusterStatus(st); updateRegionLoad(); for(CostFromRegionLoadFunction cost : regionLoadFunctions) { @@ -194,7 +194,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { } @Override - public void setMasterServices(MasterServices masterServices) { + public synchronized void setMasterServices(MasterServices masterServices) { super.setMasterServices(masterServices); this.localityCost.setServices(masterServices); this.localityCandidateGenerator.setServices(masterServices); @@ -202,7 +202,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { } @Override - protected boolean areSomeRegionReplicasColocated(Cluster c) { + protected synchronized boolean areSomeRegionReplicasColocated(Cluster c) { regionReplicaHostCostFunction.init(c); if (regionReplicaHostCostFunction.cost() > 0) return true; regionReplicaRackCostFunction.init(c); @@ -215,7 +215,8 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { * should always approach the optimal state given enough steps. */ @Override - public List balanceCluster(Map> clusterState) { + public synchronized List balanceCluster(Map> clusterState) { List plans = balanceMasterRegions(clusterState); if (plans != null || clusterState == null || clusterState.size() <= 1) { return plans;