From 43d661b008cda46604ddde2187945bb0caa5bc5f Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Mon, 26 Feb 2018 16:26:36 -0800 Subject: [PATCH] HBASE-20069 fix existing findbugs errors in hbase-server; ADDENDUM Address review --- .../hbase/master/ClusterStatusPublisher.java | 6 +++++- .../hadoop/hbase/regionserver/MemStoreFlusher.java | 14 +++----------- .../hbase/regionserver/RegionCoprocessorHost.java | 4 +++- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java index 5e97204f408..21fa263d5b4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java @@ -134,7 +134,7 @@ public class ClusterStatusPublisher extends ScheduledChore { @Override protected void chore() { - if (!connected) { + if (!isConnected()) { return; } @@ -170,6 +170,10 @@ public class ClusterStatusPublisher extends ScheduledChore { publisher.close(); } + private synchronized boolean isConnected() { + return this.connected; + } + /** * Create the dead server to send. A dead server is sent NB_SEND times. We send at max * MAX_SERVER_PER_MESSAGE at a time. if there are too many dead servers, we send the newly diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java index a0e65ec6169..23321e8550c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java @@ -90,17 +90,9 @@ class MemStoreFlusher implements FlushRequester { private FlushType flushType; /** - * Singleton instance of this class inserted into flush queue. + * Singleton instance inserted into flush queue used for signaling. */ - private static final WakeupFlushThread WAKEUPFLUSH_INSTANCE = new WakeupFlushThread(); - - /** - * Marker class used as a token inserted into flush queue that ensures the flusher does not sleep. - * Create a single instance only. - */ - private static final class WakeupFlushThread implements FlushQueueEntry { - private WakeupFlushThread() {} - + private static final FlushQueueEntry WAKEUPFLUSH_INSTANCE = new FlushQueueEntry() { @Override public long getDelay(TimeUnit unit) { return 0; @@ -120,7 +112,7 @@ class MemStoreFlusher implements FlushRequester { public int hashCode() { return 42; } - } + }; /** diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java index f3c93dce674..47b389af113 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java @@ -1119,6 +1119,8 @@ public class RegionCoprocessorHost * @return true or false to return to client if default processing should be bypassed, or null * otherwise */ + @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="NP_BOOLEAN_RETURN_NULL", + justification="Null is legit") public Boolean preCheckAndPutAfterRowLock( final byte[] row, final byte[] family, final byte[] qualifier, final CompareOperator op, final ByteArrayComparable comparator, final Put put) throws IOException { @@ -1207,7 +1209,7 @@ public class RegionCoprocessorHost * or null otherwise */ @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="NP_BOOLEAN_RETURN_NULL", - justification="TODO: Fix") + justification="Null is legit") public Boolean preCheckAndDeleteAfterRowLock(final byte[] row, final byte[] family, final byte[] qualifier, final CompareOperator op, final ByteArrayComparable comparator, final Delete delete) throws IOException {