hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1399514 - in /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase: client/HBaseAdmin.java ipc/HBaseServer.java master/balancer/StochasticLoadBalancer.java thrift/IncrementCoalescer.java
Date Thu, 18 Oct 2012 04:34:32 GMT
Author: tedyu
Date: Thu Oct 18 04:34:32 2012
New Revision: 1399514

URL: http://svn.apache.org/viewvc?rev=1399514&view=rev
Log:
HBASE-7002 Fix all 4 findbug performance warnings (Liang Xie)


Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/IncrementCoalescer.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java?rev=1399514&r1=1399513&r2=1399514&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
Thu Oct 18 04:34:32 2012
@@ -963,12 +963,11 @@ public class HBaseAdmin implements Abort
     return execute(new MasterMonitorCallable<Pair<Integer, Integer>>() {
       @Override
       public Pair<Integer, Integer> call() throws ServiceException {
-        GetSchemaAlterStatusRequest req =
-          RequestConverter.buildGetSchemaAlterStatusRequest(tableName);
-        GetSchemaAlterStatusResponse ret = masterMonitor.getSchemaAlterStatus(null,req);
-        Pair<Integer,Integer> pair =
-          new Pair<Integer,Integer>(
-            new Integer(ret.getYetToUpdateRegions()),new Integer(ret.getTotalRegions()));
+        GetSchemaAlterStatusRequest req = RequestConverter
+            .buildGetSchemaAlterStatusRequest(tableName);
+        GetSchemaAlterStatusResponse ret = masterMonitor.getSchemaAlterStatus(null, req);
+        Pair<Integer, Integer> pair = new Pair<Integer, Integer>(Integer.valueOf(ret
+            .getYetToUpdateRegions()), Integer.valueOf(ret.getTotalRegions()));
         return pair;
       }
     });

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java?rev=1399514&r1=1399513&r2=1399514&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java Thu
Oct 18 04:34:32 2012
@@ -1133,7 +1133,7 @@ public abstract class HBaseServer implem
     SaslServer saslServer;
     private boolean useWrap = false;
     // Fake 'call' for failed authorization response
-    private final int AUTHROIZATION_FAILED_CALLID = -1;
+    private static final int AUTHROIZATION_FAILED_CALLID = -1;
     private final Call authFailedCall = new Call(AUTHROIZATION_FAILED_CALLID,
         null, this, null, 0, null);
     private ByteArrayOutputStream authFailedResponse =

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java?rev=1399514&r1=1399513&r2=1399514&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
Thu Oct 18 04:34:32 2012
@@ -557,11 +557,10 @@ public class StochasticLoadBalancer exte
     double value = 0;
 
     // Compute the min, value, and max.
-    for (String tableName : tableRegionsTotal.keySet()) {
-      max += tableRegionsTotal.get(tableName).doubleValue();
-      min += tableRegionsTotal.get(tableName).doubleValue() / (double) clusterState.size();
-      value += tableCostSeenSoFar.get(tableName).doubleValue();
-
+    for (Entry<String, MutableInt> currentEntry : tableRegionsTotal.entrySet()) {
+      max += tableRegionsTotal.get(currentEntry.getKey()).doubleValue();
+      min += tableRegionsTotal.get(currentEntry.getKey()).doubleValue() / clusterState.size();
+      value += tableCostSeenSoFar.get(currentEntry.getKey()).doubleValue();
     }
     return scale(min, max, value);
   }

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/IncrementCoalescer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/IncrementCoalescer.java?rev=1399514&r1=1399513&r2=1399514&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/IncrementCoalescer.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift/IncrementCoalescer.java
Thu Oct 18 04:34:32 2012
@@ -223,7 +223,7 @@ public class IncrementCoalescer implemen
       Long value = countersMap.remove(key);
       if (value == null) {
         // There was nothing there, create a new value
-        value = new Long(currentAmount);
+        value = Long.valueOf(currentAmount);
       } else {
         value += currentAmount;
         successfulCoalescings.incrementAndGet();



Mime
View raw message