hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brfrn...@apache.org
Subject [hbase] branch master updated: HBASE-11062 hbtop (addendum - fix error-prone errors)
Date Mon, 09 Sep 2019 01:33:45 GMT
This is an automated email from the ASF dual-hosted git repository.

brfrn169 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 7648855  HBASE-11062 hbtop (addendum - fix error-prone errors)
7648855 is described below

commit 7648855e59cef0723fb6bc38de6d68a352fdeabf
Author: Toshihiro Suzuki <brfrn169@gmail.com>
AuthorDate: Sun Sep 8 00:55:24 2019 +0900

    HBASE-11062 hbtop (addendum - fix error-prone errors)
    
    Signed-off-by: Duo Zhang <zhangduo@apache.org>
---
 .../src/main/java/org/apache/hadoop/hbase/hbtop/HBTop.java     |  2 +-
 .../hadoop/hbase/hbtop/mode/RegionServerModeStrategy.java      |  1 -
 .../org/apache/hadoop/hbase/hbtop/mode/TableModeStrategy.java  |  1 -
 .../hadoop/hbase/hbtop/screen/field/FieldScreenView.java       |  8 ++++++++
 .../apache/hadoop/hbase/hbtop/screen/mode/ModeScreenView.java  |  8 ++++++++
 .../hbase/hbtop/screen/top/FilterDisplayModeScreenView.java    |  5 ++---
 .../apache/hadoop/hbase/hbtop/screen/top/TopScreenView.java    |  6 ++++++
 .../hadoop/hbase/hbtop/terminal/impl/KeyPressGenerator.java    | 10 +++++++---
 8 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/HBTop.java b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/HBTop.java
index d657a37..34c83f5 100644
--- a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/HBTop.java
+++ b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/HBTop.java
@@ -84,7 +84,7 @@ public class HBTop extends Configured implements Tool {
         if (delay < 1) {
           LOGGER.warn("Delay set too low or invalid, using default");
         } else {
-          initialRefreshDelay = delay * 1000;
+          initialRefreshDelay = delay * 1000L;
         }
       }
 
diff --git a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/mode/RegionServerModeStrategy.java
b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/mode/RegionServerModeStrategy.java
index 58380f6..d64f713 100644
--- a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/mode/RegionServerModeStrategy.java
+++ b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/mode/RegionServerModeStrategy.java
@@ -24,7 +24,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-
 import org.apache.hadoop.hbase.ClusterMetrics;
 import org.apache.hadoop.hbase.ServerMetrics;
 import org.apache.hadoop.hbase.hbtop.Record;
diff --git a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/mode/TableModeStrategy.java
b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/mode/TableModeStrategy.java
index fb8d66d..1da074f 100644
--- a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/mode/TableModeStrategy.java
+++ b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/mode/TableModeStrategy.java
@@ -21,7 +21,6 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-
 import org.apache.hadoop.hbase.ClusterMetrics;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.hbtop.Record;
diff --git a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/field/FieldScreenView.java
b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/field/FieldScreenView.java
index 0d9c6b9..92fdfda 100644
--- a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/field/FieldScreenView.java
+++ b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/field/FieldScreenView.java
@@ -85,6 +85,10 @@ public class FieldScreenView extends AbstractScreenView {
       case Enter:
         fieldScreenPresenter.turnOffMoveMode();
         return this;
+
+      default:
+        // Do nothing
+        break;
     }
 
     if (keyPress.getType() != KeyPress.Type.Character) {
@@ -104,6 +108,10 @@ public class FieldScreenView extends AbstractScreenView {
 
       case 'q':
         return fieldScreenPresenter.transitionToNextScreen();
+
+      default:
+        // Do nothing
+        break;
     }
 
     return this;
diff --git a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/mode/ModeScreenView.java
b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/mode/ModeScreenView.java
index f3be127..bda9853 100644
--- a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/mode/ModeScreenView.java
+++ b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/mode/ModeScreenView.java
@@ -78,6 +78,10 @@ public class ModeScreenView extends AbstractScreenView {
       case End:
         modeScreenPresenter.pageDown();
         return this;
+
+      default:
+        // Do nothing
+        break;
     }
 
     if (keyPress.getType() != KeyPress.Type.Character) {
@@ -88,6 +92,10 @@ public class ModeScreenView extends AbstractScreenView {
     switch (keyPress.getCharacter()) {
       case 'q':
         return modeScreenPresenter.transitionToNextScreen(false);
+
+      default:
+        // Do nothing
+        break;
     }
 
     return this;
diff --git a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/top/FilterDisplayModeScreenView.java
b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/top/FilterDisplayModeScreenView.java
index c186d73..e85a4b7 100644
--- a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/top/FilterDisplayModeScreenView.java
+++ b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/top/FilterDisplayModeScreenView.java
@@ -54,9 +54,8 @@ public class FilterDisplayModeScreenView extends AbstractScreenView {
 
   @Override
   public ScreenView handleKeyPress(KeyPress keyPress) {
-    switch (keyPress.getType()) {
-      case Enter:
-        return filterDisplayModeScreenPresenter.returnToNextScreen();
+    if (keyPress.getType() == KeyPress.Type.Enter) {
+      return filterDisplayModeScreenPresenter.returnToNextScreen();
     }
     return this;
   }
diff --git a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/top/TopScreenView.java
b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/top/TopScreenView.java
index 0f52b37..9a29177 100644
--- a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/top/TopScreenView.java
+++ b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/screen/top/TopScreenView.java
@@ -115,6 +115,10 @@ public class TopScreenView extends AbstractScreenView {
 
       case Escape:
         return null;
+
+      default:
+        // Do nothing
+        break;
     }
 
     if (keyPress.getType() != KeyPress.Type.Character) {
@@ -178,12 +182,14 @@ public class TopScreenView extends AbstractScreenView {
     return this;
   }
 
+  @Override
   public TerminalSize getTerminalSize() {
     TerminalSize terminalSize = super.getTerminalSize();
     updatePageSize(terminalSize);
     return terminalSize;
   }
 
+  @Override
   public TerminalSize doResizeIfNecessary() {
     TerminalSize terminalSize = super.doResizeIfNecessary();
     if (terminalSize == null) {
diff --git a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/terminal/impl/KeyPressGenerator.java
b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/terminal/impl/KeyPressGenerator.java
index 29122cb..a20222c 100644
--- a/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/terminal/impl/KeyPressGenerator.java
+++ b/hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/terminal/impl/KeyPressGenerator.java
@@ -75,8 +75,8 @@ public class KeyPressGenerator {
   }
 
   public void start() {
-    executorService.submit(this::readerThread);
-    executorService.submit(this::generatorThread);
+    executorService.execute(this::readerThread);
+    executorService.execute(this::generatorThread);
   }
 
   private void initState() {
@@ -158,6 +158,10 @@ public class KeyPressGenerator {
           case '\t':
             offer(new KeyPress(KeyPress.Type.Tab, '\t', false, false, false));
             continue;
+
+          default:
+            // Do nothing
+            break;
         }
 
         if (ch < 32) {
@@ -248,7 +252,7 @@ public class KeyPressGenerator {
       return false;
     }
     Character.UnicodeBlock block = Character.UnicodeBlock.of(ch);
-    return block != null && block != Character.UnicodeBlock.SPECIALS;
+    return block != null && !block.equals(Character.UnicodeBlock.SPECIALS);
   }
 
   private void ctrlAltAndCharacter(char ch) {


Mime
View raw message