diff options
author | Lukacs Berki <lberki@google.com> | 2016-08-05 09:44:23 +0000 |
---|---|---|
committer | Yun Peng <pcloudy@google.com> | 2016-08-05 13:32:43 +0000 |
commit | f107debac45ddf5859b1eb963379769b5815b18f (patch) | |
tree | ce4306be43dc8ccd4ed5f4b618d1694a84b233a0 /src/main/java/com/google/devtools/build/lib/unix/LocalClientSocket.java | |
parent | 9a9981e7c69276e61f998bc4c67525c1e45232f9 (diff) |
Remove the AF_UNIX client/server communication protocol.
It has been superseded by gRPC.
RELNOTES[INC]: Blaze doesn't support Unix domain sockets for communication between its client and server anymore. Therefore, the --command_port command line argument doesn't accept -1 as a valid value anymore.
--
MOS_MIGRATED_REVID=129424092
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/unix/LocalClientSocket.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/unix/LocalClientSocket.java | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/unix/LocalClientSocket.java b/src/main/java/com/google/devtools/build/lib/unix/LocalClientSocket.java deleted file mode 100644 index 10335d1a93..0000000000 --- a/src/main/java/com/google/devtools/build/lib/unix/LocalClientSocket.java +++ /dev/null @@ -1,117 +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.unix; - -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.SocketException; - -/** - * <p>An implementation of client Socket for local (AF_UNIX) sockets. - * - * <p>This class intentionally doesn't extend java.net.Socket although it - * has some similarity to it. The java.net class hierarchy is a terrible mess - * and is inextricably coupled to the Internet Protocol. - * - * <p>This code is not intended to be portable to non-UNIX platforms. - */ -public class LocalClientSocket extends LocalSocket { - - /** - * Constructs an unconnected local client socket. - * - * @throws IOException if the socket could not be created. - */ - public LocalClientSocket() throws IOException { - super(); - } - - /** - * Constructs a client socket and connects it to the specified address. - * - * @throws IOException if either of the socket/connect operations failed. - */ - public LocalClientSocket(LocalSocketAddress address) throws IOException { - super(); - connect(address); - } - - /** - * Connect to the specified server. Blocks until the server accepts the - * connection. - * - * @throws IOException if the connection failed. - */ - public synchronized void connect(LocalSocketAddress address) - throws IOException { - checkNotClosed(); - if (state == State.CONNECTED) { - throw new SocketException("socket is already connected"); - } - connect(fd, address.getName().toString()); // JNI - this.address = address; - this.state = State.CONNECTED; - } - - /** - * Returns the input stream for reading from the server. - * - * @param closeSocket close the socket when this input stream is closed. - * @throws IOException if there was a problem. - */ - public synchronized InputStream getInputStream(final boolean closeSocket) throws IOException { - checkConnected(); - checkInputNotShutdown(); - return new FileInputStream(fd) { - @Override - public void close() throws IOException { - if (closeSocket) { - LocalClientSocket.this.close(); - } - } - }; - } - - /** - * Returns the input stream for reading from the server. - * - * @throws IOException if there was a problem. - */ - public synchronized InputStream getInputStream() throws IOException { - return getInputStream(false); - } - - /** - * Returns the output stream for writing to the server. - * - * @throws IOException if there was a problem. - */ - public synchronized OutputStream getOutputStream() throws IOException { - checkConnected(); - checkOutputNotShutdown(); - return new FileOutputStream(fd) { - @Override public void close() { - // Don't close the file descriptor. - } - }; - } - - @Override - public String toString() { - return "LocalClientSocket(" + address + ")"; - } -} |