You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by br...@apache.org on 2019/09/09 01:42:22 UTC
[hbase] branch branch-2.2 updated: HBASE-11062 hbtop (addendum -
fix error-prone errors)
This is an automated email from the ASF dual-hosted git repository.
brfrn169 pushed a commit to branch branch-2.2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.2 by this push:
new 4aaf883 HBASE-11062 hbtop (addendum - fix error-prone errors)
4aaf883 is described below
commit 4aaf883e2b1a62dcdf833b2a093510e42245b79a
Author: Toshihiro Suzuki <br...@gmail.com>
AuthorDate: Sun Sep 8 00:55:24 2019 +0900
HBASE-11062 hbtop (addendum - fix error-prone errors)
Signed-off-by: Duo Zhang <zh...@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) {