HBASE-11062 hbtop (addendum - fix error-prone errors)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
parent
cb976b0306
commit
7648855e59
|
@ -84,7 +84,7 @@ public class HBTop extends Configured implements Tool {
|
||||||
if (delay < 1) {
|
if (delay < 1) {
|
||||||
LOGGER.warn("Delay set too low or invalid, using default");
|
LOGGER.warn("Delay set too low or invalid, using default");
|
||||||
} else {
|
} else {
|
||||||
initialRefreshDelay = delay * 1000;
|
initialRefreshDelay = delay * 1000L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.ClusterMetrics;
|
import org.apache.hadoop.hbase.ClusterMetrics;
|
||||||
import org.apache.hadoop.hbase.ServerMetrics;
|
import org.apache.hadoop.hbase.ServerMetrics;
|
||||||
import org.apache.hadoop.hbase.hbtop.Record;
|
import org.apache.hadoop.hbase.hbtop.Record;
|
||||||
|
|
|
@ -21,7 +21,6 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.ClusterMetrics;
|
import org.apache.hadoop.hbase.ClusterMetrics;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.hbtop.Record;
|
import org.apache.hadoop.hbase.hbtop.Record;
|
||||||
|
|
|
@ -85,6 +85,10 @@ public class FieldScreenView extends AbstractScreenView {
|
||||||
case Enter:
|
case Enter:
|
||||||
fieldScreenPresenter.turnOffMoveMode();
|
fieldScreenPresenter.turnOffMoveMode();
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Do nothing
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyPress.getType() != KeyPress.Type.Character) {
|
if (keyPress.getType() != KeyPress.Type.Character) {
|
||||||
|
@ -104,6 +108,10 @@ public class FieldScreenView extends AbstractScreenView {
|
||||||
|
|
||||||
case 'q':
|
case 'q':
|
||||||
return fieldScreenPresenter.transitionToNextScreen();
|
return fieldScreenPresenter.transitionToNextScreen();
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Do nothing
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -78,6 +78,10 @@ public class ModeScreenView extends AbstractScreenView {
|
||||||
case End:
|
case End:
|
||||||
modeScreenPresenter.pageDown();
|
modeScreenPresenter.pageDown();
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Do nothing
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyPress.getType() != KeyPress.Type.Character) {
|
if (keyPress.getType() != KeyPress.Type.Character) {
|
||||||
|
@ -88,6 +92,10 @@ public class ModeScreenView extends AbstractScreenView {
|
||||||
switch (keyPress.getCharacter()) {
|
switch (keyPress.getCharacter()) {
|
||||||
case 'q':
|
case 'q':
|
||||||
return modeScreenPresenter.transitionToNextScreen(false);
|
return modeScreenPresenter.transitionToNextScreen(false);
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Do nothing
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -54,8 +54,7 @@ public class FilterDisplayModeScreenView extends AbstractScreenView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScreenView handleKeyPress(KeyPress keyPress) {
|
public ScreenView handleKeyPress(KeyPress keyPress) {
|
||||||
switch (keyPress.getType()) {
|
if (keyPress.getType() == KeyPress.Type.Enter) {
|
||||||
case Enter:
|
|
||||||
return filterDisplayModeScreenPresenter.returnToNextScreen();
|
return filterDisplayModeScreenPresenter.returnToNextScreen();
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -115,6 +115,10 @@ public class TopScreenView extends AbstractScreenView {
|
||||||
|
|
||||||
case Escape:
|
case Escape:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Do nothing
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyPress.getType() != KeyPress.Type.Character) {
|
if (keyPress.getType() != KeyPress.Type.Character) {
|
||||||
|
@ -178,12 +182,14 @@ public class TopScreenView extends AbstractScreenView {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public TerminalSize getTerminalSize() {
|
public TerminalSize getTerminalSize() {
|
||||||
TerminalSize terminalSize = super.getTerminalSize();
|
TerminalSize terminalSize = super.getTerminalSize();
|
||||||
updatePageSize(terminalSize);
|
updatePageSize(terminalSize);
|
||||||
return terminalSize;
|
return terminalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public TerminalSize doResizeIfNecessary() {
|
public TerminalSize doResizeIfNecessary() {
|
||||||
TerminalSize terminalSize = super.doResizeIfNecessary();
|
TerminalSize terminalSize = super.doResizeIfNecessary();
|
||||||
if (terminalSize == null) {
|
if (terminalSize == null) {
|
||||||
|
|
|
@ -75,8 +75,8 @@ public class KeyPressGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
executorService.submit(this::readerThread);
|
executorService.execute(this::readerThread);
|
||||||
executorService.submit(this::generatorThread);
|
executorService.execute(this::generatorThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initState() {
|
private void initState() {
|
||||||
|
@ -158,6 +158,10 @@ public class KeyPressGenerator {
|
||||||
case '\t':
|
case '\t':
|
||||||
offer(new KeyPress(KeyPress.Type.Tab, '\t', false, false, false));
|
offer(new KeyPress(KeyPress.Type.Tab, '\t', false, false, false));
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Do nothing
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch < 32) {
|
if (ch < 32) {
|
||||||
|
@ -248,7 +252,7 @@ public class KeyPressGenerator {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Character.UnicodeBlock block = Character.UnicodeBlock.of(ch);
|
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) {
|
private void ctrlAltAndCharacter(char ch) {
|
||||||
|
|
Loading…
Reference in New Issue