Skip to content

Commit 23ebf36

Browse files
committed
inprocess: Delete "standalone" internal transport
This had been used for a time with a combined inprocess+binder server. However, just having multiple servers worked fine and this is no longer used/needed.
1 parent 84d30af commit 23ebf36

File tree

3 files changed

+9
-268
lines changed

3 files changed

+9
-268
lines changed

inprocess/src/main/java/io/grpc/inprocess/InProcessTransport.java

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static java.lang.Math.max;
2222

2323
import com.google.common.base.MoreObjects;
24-
import com.google.common.base.Optional;
2524
import com.google.common.io.ByteStreams;
2625
import com.google.common.util.concurrent.ListenableFuture;
2726
import com.google.common.util.concurrent.SettableFuture;
@@ -54,7 +53,6 @@
5453
import io.grpc.internal.ManagedClientTransport;
5554
import io.grpc.internal.NoopClientStream;
5655
import io.grpc.internal.ObjectPool;
57-
import io.grpc.internal.ServerListener;
5856
import io.grpc.internal.ServerStream;
5957
import io.grpc.internal.ServerStreamListener;
6058
import io.grpc.internal.ServerTransport;
@@ -90,7 +88,6 @@ final class InProcessTransport implements ServerTransport, ConnectionClientTrans
9088
private final int clientMaxInboundMetadataSize;
9189
private final String authority;
9290
private final String userAgent;
93-
private final Optional<ServerListener> optionalServerListener;
9491
private int serverMaxInboundMetadataSize;
9592
private final boolean includeCauseWithStatus;
9693
private ObjectPool<ScheduledExecutorService> serverSchedulerPool;
@@ -139,8 +136,8 @@ protected void handleNotInUse() {
139136
}
140137
};
141138

142-
private InProcessTransport(SocketAddress address, int maxInboundMetadataSize, String authority,
143-
String userAgent, Attributes eagAttrs, Optional<ServerListener> optionalServerListener,
139+
public InProcessTransport(SocketAddress address, int maxInboundMetadataSize, String authority,
140+
String userAgent, Attributes eagAttrs,
144141
boolean includeCauseWithStatus, long assumedMessageSize) {
145142
this.address = address;
146143
this.clientMaxInboundMetadataSize = maxInboundMetadataSize;
@@ -153,48 +150,23 @@ private InProcessTransport(SocketAddress address, int maxInboundMetadataSize, St
153150
.set(Grpc.TRANSPORT_ATTR_REMOTE_ADDR, address)
154151
.set(Grpc.TRANSPORT_ATTR_LOCAL_ADDR, address)
155152
.build();
156-
this.optionalServerListener = optionalServerListener;
157153
logId = InternalLogId.allocate(getClass(), address.toString());
158154
this.includeCauseWithStatus = includeCauseWithStatus;
159155
this.assumedMessageSize = assumedMessageSize;
160156
}
161157

162-
public InProcessTransport(
163-
SocketAddress address, int maxInboundMetadataSize, String authority, String userAgent,
164-
Attributes eagAttrs, boolean includeCauseWithStatus, long assumedMessageSize) {
165-
this(address, maxInboundMetadataSize, authority, userAgent, eagAttrs,
166-
Optional.<ServerListener>absent(), includeCauseWithStatus, assumedMessageSize);
167-
}
168-
169-
InProcessTransport(
170-
String name, int maxInboundMetadataSize, String authority, String userAgent,
171-
Attributes eagAttrs, ObjectPool<ScheduledExecutorService> serverSchedulerPool,
172-
List<ServerStreamTracer.Factory> serverStreamTracerFactories,
173-
ServerListener serverListener, boolean includeCauseWithStatus, long assumedMessageSize) {
174-
this(new InProcessSocketAddress(name), maxInboundMetadataSize, authority, userAgent, eagAttrs,
175-
Optional.of(serverListener), includeCauseWithStatus, assumedMessageSize);
176-
this.serverMaxInboundMetadataSize = maxInboundMetadataSize;
177-
this.serverSchedulerPool = serverSchedulerPool;
178-
this.serverStreamTracerFactories = serverStreamTracerFactories;
179-
}
180-
181158
@CheckReturnValue
182159
@Override
183160
public synchronized Runnable start(ManagedClientTransport.Listener listener) {
184161
this.clientTransportListener = listener;
185-
if (optionalServerListener.isPresent()) {
162+
InProcessServer server = InProcessServer.findServer(address);
163+
if (server != null) {
164+
serverMaxInboundMetadataSize = server.getMaxInboundMetadataSize();
165+
serverSchedulerPool = server.getScheduledExecutorServicePool();
186166
serverScheduler = serverSchedulerPool.getObject();
187-
serverTransportListener = optionalServerListener.get().transportCreated(this);
188-
} else {
189-
InProcessServer server = InProcessServer.findServer(address);
190-
if (server != null) {
191-
serverMaxInboundMetadataSize = server.getMaxInboundMetadataSize();
192-
serverSchedulerPool = server.getScheduledExecutorServicePool();
193-
serverScheduler = serverSchedulerPool.getObject();
194-
serverStreamTracerFactories = server.getStreamTracerFactories();
195-
// Must be semi-initialized; past this point, can begin receiving requests
196-
serverTransportListener = server.register(this);
197-
}
167+
serverStreamTracerFactories = server.getStreamTracerFactories();
168+
// Must be semi-initialized; past this point, can begin receiving requests
169+
serverTransportListener = server.register(this);
198170
}
199171
if (serverTransportListener == null) {
200172
shutdownStatus = Status.UNAVAILABLE.withDescription("Could not find server: " + address);

inprocess/src/main/java/io/grpc/inprocess/InternalInProcess.java

Lines changed: 0 additions & 67 deletions
This file was deleted.

inprocess/src/test/java/io/grpc/inprocess/StandaloneInProcessTransportTest.java

Lines changed: 0 additions & 164 deletions
This file was deleted.

0 commit comments

Comments
 (0)