aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/server
diff options
context:
space:
mode:
authorGravatar lberki <lberki@google.com>2018-02-06 10:11:56 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-06 10:13:41 -0800
commitbbcf2032f55bd989dabb053eb52d89d3ef5cefa7 (patch)
tree6b061b8e73f8007cdb85630a8f5018eee1151012 /src/main/java/com/google/devtools/build/lib/server
parent5a960cfc7464edeced1da68d87b1e27d53a6742c (diff)
Delete the now-useless interfaces ServerCommand and CommandExecutor.
We apparently don't have any other implementations of these interfaces than BlazeCommandDispatcher, so let's not have them at all; we can always put back an interface with the exec() method if need be. RELNOTES: None. PiperOrigin-RevId: 184698573
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/server')
-rw-r--r--src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java14
-rw-r--r--src/main/java/com/google/devtools/build/lib/server/RPCServer.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/server/ServerCommand.java48
3 files changed, 9 insertions, 57 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java b/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java
index 58ad98edae..1213d6e47d 100644
--- a/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java
+++ b/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java
@@ -25,10 +25,10 @@ import com.google.common.util.concurrent.Uninterruptibles;
import com.google.devtools.build.lib.clock.BlazeClock;
import com.google.devtools.build.lib.clock.Clock;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
+import com.google.devtools.build.lib.runtime.BlazeCommandDispatcher;
import com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.LockingMode;
import com.google.devtools.build.lib.runtime.BlazeCommandResult;
import com.google.devtools.build.lib.runtime.BlazeRuntime;
-import com.google.devtools.build.lib.runtime.CommandExecutor;
import com.google.devtools.build.lib.runtime.proto.InvocationPolicyOuterClass.InvocationPolicy;
import com.google.devtools.build.lib.server.CommandProtos.CancelRequest;
import com.google.devtools.build.lib.server.CommandProtos.CancelResponse;
@@ -152,10 +152,10 @@ public class GrpcServerImpl implements RPCServer {
*/
public static class Factory implements RPCServer.Factory {
@Override
- public RPCServer create(CommandExecutor commandExecutor, Clock clock, int port,
+ public RPCServer create(BlazeCommandDispatcher dispatcher, Clock clock, int port,
Path workspace, Path serverDirectory, int maxIdleSeconds) throws IOException {
return new GrpcServerImpl(
- commandExecutor, clock, port, workspace, serverDirectory, maxIdleSeconds);
+ dispatcher, clock, port, workspace, serverDirectory, maxIdleSeconds);
}
}
@@ -497,7 +497,7 @@ public class GrpcServerImpl implements RPCServer {
@GuardedBy("runningCommands")
private final Map<String, RunningCommand> runningCommands = new HashMap<>();
- private final CommandExecutor commandExecutor;
+ private final BlazeCommandDispatcher dispatcher;
private final ExecutorService streamExecutorPool;
private final ExecutorService commandExecutorPool;
private final Clock clock;
@@ -517,7 +517,7 @@ public class GrpcServerImpl implements RPCServer {
private IdleServerTasks idleServerTasks;
boolean serving;
- public GrpcServerImpl(CommandExecutor commandExecutor, Clock clock, int port,
+ public GrpcServerImpl(BlazeCommandDispatcher dispatcher, Clock clock, int port,
Path workspace, Path serverDirectory, int maxIdleSeconds) throws IOException {
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
@@ -533,7 +533,7 @@ public class GrpcServerImpl implements RPCServer {
pidInFile = new String(FileSystemUtils.readContentAsLatin1(pidFile));
deleteAtExit(pidFile);
- this.commandExecutor = commandExecutor;
+ this.dispatcher = dispatcher;
this.clock = clock;
this.serverDirectory = serverDirectory;
this.workspace = workspace;
@@ -852,7 +852,7 @@ public class GrpcServerImpl implements RPCServer {
InvocationPolicy policy = InvocationPolicyParser.parsePolicy(request.getInvocationPolicy());
logger.info(BlazeRuntime.getRequestLogString(args));
result =
- commandExecutor.exec(
+ dispatcher.exec(
policy,
args,
rpcOutErr,
diff --git a/src/main/java/com/google/devtools/build/lib/server/RPCServer.java b/src/main/java/com/google/devtools/build/lib/server/RPCServer.java
index 7ebb77e2b0..014b17b5ae 100644
--- a/src/main/java/com/google/devtools/build/lib/server/RPCServer.java
+++ b/src/main/java/com/google/devtools/build/lib/server/RPCServer.java
@@ -14,7 +14,7 @@
package com.google.devtools.build.lib.server;
import com.google.devtools.build.lib.clock.Clock;
-import com.google.devtools.build.lib.runtime.CommandExecutor;
+import com.google.devtools.build.lib.runtime.BlazeCommandDispatcher;
import com.google.devtools.build.lib.vfs.Path;
import java.io.IOException;
@@ -28,7 +28,7 @@ public interface RPCServer {
* Present so that we don't need to invoke a constructor with multiple arguments by reflection.
*/
interface Factory {
- RPCServer create(CommandExecutor commandExecutor, Clock clock, int port,
+ RPCServer create(BlazeCommandDispatcher dispatcher, Clock clock, int port,
Path workspace, Path serverDirectory, int maxIdleSeconds) throws IOException;
}
diff --git a/src/main/java/com/google/devtools/build/lib/server/ServerCommand.java b/src/main/java/com/google/devtools/build/lib/server/ServerCommand.java
deleted file mode 100644
index c47e12853d..0000000000
--- a/src/main/java/com/google/devtools/build/lib/server/ServerCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2014 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-package com.google.devtools.build.lib.server;
-
-import com.google.devtools.build.lib.runtime.BlazeCommandDispatcher;
-import com.google.devtools.build.lib.runtime.BlazeCommandResult;
-import com.google.devtools.build.lib.runtime.proto.InvocationPolicyOuterClass.InvocationPolicy;
-import com.google.devtools.build.lib.util.Pair;
-import com.google.devtools.build.lib.util.io.OutErr;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * The {@link RPCServer} calls an arbitrary command implementing this
- * interface.
- */
-public interface ServerCommand {
-
- /**
- * Executes the request, writing any output or error messages into err. Returns 0 on success; any
- * other value or exception indicates an error.
- *
- * @param startupOptionsTaggedWithBazelRc List of startup options in Pair(bazelRc, option) form.
- * The empty string bazelRc is interpreted as the command line, and option should be in
- * --[no]flag or --flag=value form. If we don't have access to this information (--batch),
- * leave this parameter as Optional.empty().
- */
- BlazeCommandResult exec(
- InvocationPolicy policy,
- List<String> args,
- OutErr outErr,
- BlazeCommandDispatcher.LockingMode lockingMode,
- String clientDescription,
- long firstContactTime,
- Optional<List<Pair<String, String>>> startupOptionsTaggedWithBazelRc)
- throws InterruptedException;
-}