Skip to content

Commit

Permalink
inprocess: Delete "standalone" internal transport
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ejona86 committed Oct 17, 2024
1 parent 84d30af commit 23ebf36
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 268 deletions.
46 changes: 9 additions & 37 deletions inprocess/src/main/java/io/grpc/inprocess/InProcessTransport.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static java.lang.Math.max;

import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;
import com.google.common.io.ByteStreams;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
Expand Down Expand Up @@ -54,7 +53,6 @@
import io.grpc.internal.ManagedClientTransport;
import io.grpc.internal.NoopClientStream;
import io.grpc.internal.ObjectPool;
import io.grpc.internal.ServerListener;
import io.grpc.internal.ServerStream;
import io.grpc.internal.ServerStreamListener;
import io.grpc.internal.ServerTransport;
Expand Down Expand Up @@ -90,7 +88,6 @@ final class InProcessTransport implements ServerTransport, ConnectionClientTrans
private final int clientMaxInboundMetadataSize;
private final String authority;
private final String userAgent;
private final Optional<ServerListener> optionalServerListener;
private int serverMaxInboundMetadataSize;
private final boolean includeCauseWithStatus;
private ObjectPool<ScheduledExecutorService> serverSchedulerPool;
Expand Down Expand Up @@ -139,8 +136,8 @@ protected void handleNotInUse() {
}
};

private InProcessTransport(SocketAddress address, int maxInboundMetadataSize, String authority,
String userAgent, Attributes eagAttrs, Optional<ServerListener> optionalServerListener,
public InProcessTransport(SocketAddress address, int maxInboundMetadataSize, String authority,
String userAgent, Attributes eagAttrs,
boolean includeCauseWithStatus, long assumedMessageSize) {
this.address = address;
this.clientMaxInboundMetadataSize = maxInboundMetadataSize;
Expand All @@ -153,48 +150,23 @@ private InProcessTransport(SocketAddress address, int maxInboundMetadataSize, St
.set(Grpc.TRANSPORT_ATTR_REMOTE_ADDR, address)
.set(Grpc.TRANSPORT_ATTR_LOCAL_ADDR, address)
.build();
this.optionalServerListener = optionalServerListener;
logId = InternalLogId.allocate(getClass(), address.toString());
this.includeCauseWithStatus = includeCauseWithStatus;
this.assumedMessageSize = assumedMessageSize;
}

public InProcessTransport(
SocketAddress address, int maxInboundMetadataSize, String authority, String userAgent,
Attributes eagAttrs, boolean includeCauseWithStatus, long assumedMessageSize) {
this(address, maxInboundMetadataSize, authority, userAgent, eagAttrs,
Optional.<ServerListener>absent(), includeCauseWithStatus, assumedMessageSize);
}

InProcessTransport(
String name, int maxInboundMetadataSize, String authority, String userAgent,
Attributes eagAttrs, ObjectPool<ScheduledExecutorService> serverSchedulerPool,
List<ServerStreamTracer.Factory> serverStreamTracerFactories,
ServerListener serverListener, boolean includeCauseWithStatus, long assumedMessageSize) {
this(new InProcessSocketAddress(name), maxInboundMetadataSize, authority, userAgent, eagAttrs,
Optional.of(serverListener), includeCauseWithStatus, assumedMessageSize);
this.serverMaxInboundMetadataSize = maxInboundMetadataSize;
this.serverSchedulerPool = serverSchedulerPool;
this.serverStreamTracerFactories = serverStreamTracerFactories;
}

@CheckReturnValue
@Override
public synchronized Runnable start(ManagedClientTransport.Listener listener) {
this.clientTransportListener = listener;
if (optionalServerListener.isPresent()) {
InProcessServer server = InProcessServer.findServer(address);
if (server != null) {
serverMaxInboundMetadataSize = server.getMaxInboundMetadataSize();
serverSchedulerPool = server.getScheduledExecutorServicePool();
serverScheduler = serverSchedulerPool.getObject();
serverTransportListener = optionalServerListener.get().transportCreated(this);
} else {
InProcessServer server = InProcessServer.findServer(address);
if (server != null) {
serverMaxInboundMetadataSize = server.getMaxInboundMetadataSize();
serverSchedulerPool = server.getScheduledExecutorServicePool();
serverScheduler = serverSchedulerPool.getObject();
serverStreamTracerFactories = server.getStreamTracerFactories();
// Must be semi-initialized; past this point, can begin receiving requests
serverTransportListener = server.register(this);
}
serverStreamTracerFactories = server.getStreamTracerFactories();
// Must be semi-initialized; past this point, can begin receiving requests
serverTransportListener = server.register(this);
}
if (serverTransportListener == null) {
shutdownStatus = Status.UNAVAILABLE.withDescription("Could not find server: " + address);
Expand Down
67 changes: 0 additions & 67 deletions inprocess/src/main/java/io/grpc/inprocess/InternalInProcess.java

This file was deleted.

This file was deleted.

0 comments on commit 23ebf36

Please sign in to comment.