hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-18252 Resolve BaseLoadBalancer bad practice warnings
Date Wed, 21 Jun 2017 17:12:28 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 83be50c2a -> 00f657fbe


HBASE-18252 Resolve BaseLoadBalancer bad practice warnings

Signed-off-by: tedyu <yuzhihong@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/00f657fb
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/00f657fb
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/00f657fb

Branch: refs/heads/master
Commit: 00f657fbeb5c6a19af29de6f159afae8c7ca7c38
Parents: 83be50c
Author: QilinCao <cao.qilin@zte.com.cn>
Authored: Wed Jun 21 18:34:29 2017 +0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Wed Jun 21 10:12:23 2017 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/master/balancer/BaseLoadBalancer.java  | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/00f657fb/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
index 3556e17..fda9f60 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
@@ -914,7 +914,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     private Comparator<Integer> numRegionsComparator = new Comparator<Integer>()
{
       @Override
       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>()
{
       @Override
       public int compare(Integer integer, Integer integer2) {
-        float locality1 = getLocality(integer);
-        float locality2 = getLocality(integer2);
-        if (locality1 < locality2) {
-          return -1;
-        } else if (locality1 > locality2) {
-          return 1;
-        } else {
-          return 0;
-        }
+        return Float.compare(getLocality(integer), getLocality(integer2));
       }
     };
 


Mime
View raw message