HBASE-18252 Resolve BaseLoadBalancer bad practice warnings
Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
83be50c2ab
commit
00f657fbeb
|
@ -914,7 +914,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
|
||||||
private Comparator<Integer> numRegionsComparator = new Comparator<Integer>() {
|
private Comparator<Integer> numRegionsComparator = new Comparator<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Integer integer, Integer integer2) {
|
public int compare(Integer integer, Integer integer2) {
|
||||||
return Integer.valueOf(getNumRegions(integer)).compareTo(getNumRegions(integer2));
|
return Integer.compare(getNumRegions(integer), getNumRegions(integer2));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -929,15 +929,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
|
||||||
private Comparator<Integer> localityComparator = new Comparator<Integer>() {
|
private Comparator<Integer> localityComparator = new Comparator<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Integer integer, Integer integer2) {
|
public int compare(Integer integer, Integer integer2) {
|
||||||
float locality1 = getLocality(integer);
|
return Float.compare(getLocality(integer), getLocality(integer2));
|
||||||
float locality2 = getLocality(integer2);
|
|
||||||
if (locality1 < locality2) {
|
|
||||||
return -1;
|
|
||||||
} else if (locality1 > locality2) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue