Property to configure the default rolling window size (defaults to 2)

This commit is contained in:
Guillaume Nodet
2020-11-12 00:28:19 +01:00
committed by Peter Palaga
parent 94a2a07058
commit c8c5d08e1f
4 changed files with 11 additions and 2 deletions

View File

@@ -279,6 +279,10 @@ public class DaemonParameters {
return property(Environment.MVND_NO_BUFERING).orFail().asBoolean(); return property(Environment.MVND_NO_BUFERING).orFail().asBoolean();
} }
public int rollingWindowSize() {
return property(Environment.MVND_ROLLING_WINDOW_SIZE).orFail().asInt();
}
public static String findDefaultMultimoduleProjectDirectory(Path pwd) { public static String findDefaultMultimoduleProjectDirectory(Path pwd) {
Path dir = pwd; Path dir = pwd;
do { do {

View File

@@ -63,7 +63,7 @@ public class DefaultClient implements Client {
} }
DaemonParameters parameters = new DaemonParameters(); DaemonParameters parameters = new DaemonParameters();
try (TerminalOutput output = new TerminalOutput(parameters.noBuffering(), logFile)) { try (TerminalOutput output = new TerminalOutput(parameters.noBuffering(), parameters.rollingWindowSize(), logFile)) {
try { try {
new DefaultClient(parameters).execute(output, args); new DefaultClient(parameters).execute(output, args);
} catch (DaemonException.InterruptedException e) { } catch (DaemonException.InterruptedException e) {

View File

@@ -64,6 +64,10 @@ public enum Environment {
* display. * display.
*/ */
MVND_NO_BUFERING("mvnd.noBuffering", null, "false", false), MVND_NO_BUFERING("mvnd.noBuffering", null, "false", false),
/**
* The size of the rolling window
*/
MVND_ROLLING_WINDOW_SIZE("mvnd.rollingWindowSize", null, "2", false),
/** /**
* The path to the daemon registry * The path to the daemon registry
*/ */

View File

@@ -107,11 +107,12 @@ public class TerminalOutput implements ClientOutput {
} }
} }
public TerminalOutput(boolean noBuffering, Path logFile) throws IOException { public TerminalOutput(boolean noBuffering, int rollingWindowSize, Path logFile) throws IOException {
this.start = System.currentTimeMillis(); this.start = System.currentTimeMillis();
this.terminal = TerminalBuilder.terminal(); this.terminal = TerminalBuilder.terminal();
this.dumb = terminal.getType().startsWith("dumb"); this.dumb = terminal.getType().startsWith("dumb");
this.noBuffering = noBuffering; this.noBuffering = noBuffering;
this.linesPerProject = rollingWindowSize;
terminal.enterRawMode(); terminal.enterRawMode();
Thread mainThread = Thread.currentThread(); Thread mainThread = Thread.currentThread();
daemonDispatch = m -> { daemonDispatch = m -> {