HBASE-11062 hbtop (addendum - fix error-prone errors)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
Toshihiro Suzuki 2019-09-08 00:55:24 +09:00
parent cb976b0306
commit 7648855e59
8 changed files with 32 additions and 9 deletions

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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) {

View File

@ -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) {