MCPcopy Index your code
hub / github.com/grpc/grpc-java / ServerImpl

Method ServerImpl

core/src/main/java/io/grpc/internal/ServerImpl.java:141–170  ·  view source on GitHub ↗

Construct a server. @param builder builder with configuration for server @param transportServer transport servers that will create new incoming transports @param rootContext context that callbacks for new RPCs should be derived from

(
      ServerImplBuilder builder,
      InternalServer transportServer,
      Context rootContext)

Source from the content-addressed store, hash-verified

139 * @param rootContext context that callbacks for new RPCs should be derived from
140 */
141 ServerImpl(
142 ServerImplBuilder builder,
143 InternalServer transportServer,
144 Context rootContext) {
145 this.executorPool = Preconditions.checkNotNull(builder.executorPool, "executorPool");
146 this.registry = Preconditions.checkNotNull(builder.registryBuilder.build(), "registryBuilder");
147 this.fallbackRegistry =
148 Preconditions.checkNotNull(builder.fallbackRegistry, "fallbackRegistry");
149 this.transportServer = Preconditions.checkNotNull(transportServer, "transportServer");
150 this.logId =
151 InternalLogId.allocate("Server", String.valueOf(getListenSocketsIgnoringLifecycle()));
152 // Fork from the passed in context so that it does not propagate cancellation, it only
153 // inherits values.
154 this.rootContext = Preconditions.checkNotNull(rootContext, "rootContext")
155 .fork()
156 .withValue(io.grpc.InternalServer.SERVER_CONTEXT_KEY, ServerImpl.this);
157 this.decompressorRegistry = builder.decompressorRegistry;
158 this.compressorRegistry = builder.compressorRegistry;
159 this.transportFilters = Collections.unmodifiableList(
160 new ArrayList<>(builder.transportFilters));
161 this.interceptors =
162 builder.interceptors.toArray(new ServerInterceptor[builder.interceptors.size()]);
163 this.handshakeTimeoutMillis = builder.handshakeTimeoutMillis;
164 this.binlog = builder.binlog;
165 this.channelz = builder.channelz;
166 this.serverCallTracer = builder.callTracerFactory.create();
167 this.ticker = checkNotNull(builder.ticker, "ticker");
168 channelz.addServer(this);
169 this.executorSupplier = builder.executorSupplier;
170 }
171
172 /**
173 * Bind and start the server.

Callers

nothing calls this directly

Calls 9

allocateMethod · 0.95
checkNotNullMethod · 0.80
withValueMethod · 0.80
forkMethod · 0.80
addServerMethod · 0.80
buildMethod · 0.65
sizeMethod · 0.65
createMethod · 0.65

Tested by

no test coverage detected