hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [30/30] hbase git commit: HBASE-19239 Fix findbugs and error-prone issues
Date Sat, 18 Nov 2017 01:22:58 GMT
HBASE-19239 Fix findbugs and error-prone issues

Fixes for hbase-thrift


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

Branch: refs/heads/branch-1.4
Commit: 0f888cbcf3ac09319bb168111fa8b06510dd3eb5
Parents: b2fa185
Author: Andrew Purtell <apurtell@apache.org>
Authored: Thu Nov 16 14:05:09 2017 -0800
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Fri Nov 17 17:13:34 2017 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/thrift/IncrementCoalescer.java | 25 +++++++++++++++++++-
 .../hbase/thrift/TBoundedThreadPoolServer.java  |  3 ++-
 .../hadoop/hbase/thrift/ThriftServerRunner.java |  6 ++---
 .../thrift2/ThriftHBaseServiceHandler.java      |  4 +++-
 ...TestThriftHBaseServiceHandlerWithLabels.java |  6 ++---
 5 files changed, 34 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0f888cbc/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/IncrementCoalescer.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/IncrementCoalescer.java
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/IncrementCoalescer.java
index e937f2d..205e3ad 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/IncrementCoalescer.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/IncrementCoalescer.java
@@ -142,6 +142,7 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
       namePrefix = "ICV-" + poolNumber.getAndIncrement() + "-thread-";
     }
 
+    @Override
     public Thread newThread(Runnable r) {
       Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);
       if (!t.isDaemon()) t.setDaemon(true);
@@ -163,7 +164,6 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
 
   private static final Log LOG = LogFactory.getLog(FullyQualifiedRow.class);
 
-  @SuppressWarnings("deprecation")
   public IncrementCoalescer(HBaseHandler hand) {
     this.handler = hand;
     LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>();
@@ -322,49 +322,72 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
   }
 
   // MBean get/set methods
+  @Override
   public int getQueueSize() {
     return pool.getQueue().size();
   }
+
+  @Override
   public int getMaxQueueSize() {
     return this.maxQueueSize;
   }
+
+  @Override
   public void setMaxQueueSize(int newSize) {
     this.maxQueueSize = newSize;
   }
 
+  @Override
   public long getPoolCompletedTaskCount() {
     return pool.getCompletedTaskCount();
   }
+
+  @Override
   public long getPoolTaskCount() {
     return pool.getTaskCount();
   }
+
+  @Override
   public int getPoolLargestPoolSize() {
     return pool.getLargestPoolSize();
   }
+
+  @Override
   public int getCorePoolSize() {
     return pool.getCorePoolSize();
   }
+
+  @Override
   public void setCorePoolSize(int newCoreSize) {
     pool.setCorePoolSize(newCoreSize);
   }
+
+  @Override
   public int getMaxPoolSize() {
     return pool.getMaximumPoolSize();
   }
+
+  @Override
   public void setMaxPoolSize(int newMaxSize) {
     pool.setMaximumPoolSize(newMaxSize);
   }
+
+  @Override
   public long getFailedIncrements() {
     return failedIncrements.get();
   }
 
+  @Override
   public long getSuccessfulCoalescings() {
     return successfulCoalescings.get();
   }
 
+  @Override
   public long getTotalIncrements() {
     return totalIncrements.get();
   }
 
+  @Override
   public long getCountersMapSize() {
     return countersMap.size();
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/0f888cbc/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/TBoundedThreadPoolServer.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/TBoundedThreadPoolServer.java
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/TBoundedThreadPoolServer.java
index 6ece753..5752a52 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/TBoundedThreadPoolServer.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/TBoundedThreadPoolServer.java
@@ -22,7 +22,6 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.logging.Log;
@@ -159,6 +158,7 @@ public class TBoundedThreadPoolServer extends TServer {
     serverOptions = options;
   }
 
+  @Override
   public void serve() {
     try {
       serverTransport_.listen();
@@ -272,6 +272,7 @@ public class TBoundedThreadPoolServer extends TServer {
     /**
      * Loops on processing a client forever
      */
+    @Override
     public void run() {
       TProcessor processor = null;
       TTransport inputTransport = null;

http://git-wip-us.apache.org/repos/asf/hbase/blob/0f888cbc/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
index 6d1dde8..7208a7b 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
@@ -36,13 +36,11 @@ import java.util.TreeMap;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.UnsupportedCallbackException;
 import javax.security.sasl.AuthorizeCallback;
-import javax.security.sasl.Sasl;
 import javax.security.sasl.SaslServer;
 
 import org.apache.commons.cli.CommandLine;
@@ -1906,13 +1904,15 @@ public class ThriftServerRunner implements Runnable {
   }
 
   public static class IOErrorWithCause extends IOError {
+    private static final long serialVersionUID = 3545290006843153883L;
+
     private Throwable cause;
     public IOErrorWithCause(Throwable cause) {
       this.cause = cause;
     }
 
     @Override
-    public Throwable getCause() {
+    public synchronized Throwable getCause() {
       return cause;
     }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/0f888cbc/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
index 185cd39..a43f14e 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
@@ -135,6 +135,8 @@ public class ThriftHBaseServiceHandler implements THBaseService.Iface
{
   }
 
   private static class TIOErrorWithCause extends TIOError {
+    private static final long serialVersionUID = -1164984328968862207L;
+
     private Throwable cause;
 
     public TIOErrorWithCause(Throwable cause) {
@@ -143,7 +145,7 @@ public class ThriftHBaseServiceHandler implements THBaseService.Iface
{
     }
 
     @Override
-    public Throwable getCause() {
+    public synchronized Throwable getCause() {
       return cause;
     }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/0f888cbc/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithLabels.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithLabels.java
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithLabels.java
index 4326ce3..999a8df 100644
--- a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithLabels.java
+++ b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithLabels.java
@@ -31,8 +31,6 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
@@ -75,8 +73,6 @@ import org.junit.experimental.categories.Category;
 @Category(MediumTests.class)
 public class TestThriftHBaseServiceHandlerWithLabels {
 
-  private static final Log LOG = LogFactory
-    .getLog(TestThriftHBaseServiceHandlerWithLabels.class);
 private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
 
 // Static names for tables, columns, rows, and values
@@ -257,6 +253,8 @@ public void testScanWithVisibilityLabels() throws Exception {
 }
 
 @Test
+@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="UC_USELESS_CONDITION",
+  justification="Intended")
 public void testGetScannerResultsWithAuthorizations() throws Exception {
   ThriftHBaseServiceHandler handler = createHandler();
   ByteBuffer table = wrap(tableAname);


Mime
View raw message