From 95110991e154f84c6b08a38d65a684d18bb6adcc Mon Sep 17 00:00:00 2001 From: Googler Date: Mon, 7 Jan 2019 02:39:16 -0800 Subject: [PATCH] Automatic code cleanup. PiperOrigin-RevId: 228130835 --- .../lib/runtime/BlazeCommandDispatcher.java | 34 +++++++++---------- .../build/lib/runtime/BlazeCommandResult.java | 7 ++-- .../build/lib/runtime/BlazeRuntime.java | 3 +- .../build/lib/runtime/ClientOptions.java | 2 +- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java index d76738f0043622..fb5ebf27b9f483 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java @@ -226,6 +226,23 @@ public BlazeCommandResult exec( } } + /** + * For testing ONLY. Same as {@link #exec(InvocationPolicy, List, OutErr, LockingMode, String, + * long, Optional>>)}, but automatically uses the current time. + */ + @VisibleForTesting + public BlazeCommandResult exec(List args, String clientDescription, OutErr originalOutErr) + throws InterruptedException { + return exec( + InvocationPolicy.getDefaultInstance(), + args, + originalOutErr, + LockingMode.ERROR_OUT, + clientDescription, + runtime.getClock().currentTimeMillis(), + Optional.empty() /* startupOptionBundles */); + } + private BlazeCommandResult execExclusively( OriginalUnstructuredCommandLineEvent unstructuredServerCommandLineEvent, InvocationPolicy invocationPolicy, @@ -526,23 +543,6 @@ private static BlazeCommandResult replayEarlyExitEvents( return BlazeCommandResult.exitCode(earlyExitCode); } - /** - * For testing ONLY. Same as {@link #exec(InvocationPolicy, List, OutErr, LockingMode, String, - * long, Optional>>)}, but automatically uses the current time. - */ - @VisibleForTesting - public BlazeCommandResult exec(List args, String clientDescription, OutErr originalOutErr) - throws InterruptedException { - return exec( - InvocationPolicy.getDefaultInstance(), - args, - originalOutErr, - LockingMode.ERROR_OUT, - clientDescription, - runtime.getClock().currentTimeMillis(), - Optional.empty() /* startupOptionBundles */); - } - private OutErr bufferOut(OutErr outErr, boolean fully) { OutputStream wrappedOut; if (fully) { diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandResult.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandResult.java index de861a54f9f097..e053b2643f3cb6 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandResult.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandResult.java @@ -45,6 +45,10 @@ public boolean shutdown() { return shutdown; } + public static BlazeCommandResult shutdown(ExitCode exitCode) { + return new BlazeCommandResult(exitCode, null, true); + } + @Nullable public ExecRequest getExecRequest() { return execDescription; } @@ -53,9 +57,6 @@ public static BlazeCommandResult exitCode(ExitCode exitCode) { return new BlazeCommandResult(exitCode, null, false); } - public static BlazeCommandResult shutdown(ExitCode exitCode) { - return new BlazeCommandResult(exitCode, null, true); - } public static BlazeCommandResult execute(ExecRequest execDescription) { return new BlazeCommandResult( ExitCode.SUCCESS, Preconditions.checkNotNull(execDescription), false); diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java index 437a04ea4d6898..b1a34d628a1bf6 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java @@ -990,7 +990,8 @@ private static int serverMain(Iterable modules, OutErr outErr, Stri startupOptions.shutdownOnLowSysMem, startupOptions.idleServerTasks); } catch (ReflectiveOperationException | IllegalArgumentException e) { - throw new AbruptExitException("gRPC server not compiled in", ExitCode.BLAZE_INTERNAL_ERROR); + throw new AbruptExitException( + "gRPC server not compiled in", ExitCode.BLAZE_INTERNAL_ERROR, e); } // Register the signal handler. diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ClientOptions.java b/src/main/java/com/google/devtools/build/lib/runtime/ClientOptions.java index db6f9882b81bf7..431c4fb9a7f79a 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/ClientOptions.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/ClientOptions.java @@ -78,7 +78,7 @@ public OptionOverride convert(String input) throws OptionsParsingException { try { blazeRc = Integer.valueOf(input.substring(0, colonPos)); } catch (NumberFormatException e) { - throw new OptionsParsingException(ERROR_MESSAGE); + throw new OptionsParsingException(ERROR_MESSAGE, e); } if (blazeRc < 0) {