Skip to content

Commit

Permalink
Automatic code cleanup.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 228130835
  • Loading branch information
Googler authored and Copybara-Service committed Jan 7, 2019
1 parent eb5598c commit 9511099
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,23 @@ public BlazeCommandResult exec(
}
}

/**
* For testing ONLY. Same as {@link #exec(InvocationPolicy, List, OutErr, LockingMode, String,
* long, Optional<List<Pair<String, String>>>)}, but automatically uses the current time.
*/
@VisibleForTesting
public BlazeCommandResult exec(List<String> 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,
Expand Down Expand Up @@ -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<List<Pair<String, String>>>)}, but automatically uses the current time.
*/
@VisibleForTesting
public BlazeCommandResult exec(List<String> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,8 @@ private static int serverMain(Iterable<BlazeModule> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9511099

Please sign in to comment.