HBASE-12559 Addendum fixes findbugs warnings

This commit is contained in:
tedyu 2014-12-02 04:43:34 -08:00
parent 94d57f81dc
commit 5cc0714840
1 changed files with 5 additions and 4 deletions

View File

@ -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<RegionPlan> balanceCluster(Map<ServerName, List<HRegionInfo>> clusterState) {
public synchronized List<RegionPlan> balanceCluster(Map<ServerName,
List<HRegionInfo>> clusterState) {
List<RegionPlan> plans = balanceMasterRegions(clusterState);
if (plans != null || clusterState == null || clusterState.size() <= 1) {
return plans;