MCPcopy Create free account
hub / github.com/grpc/grpc-java / ServerImplBuilder

Class ServerImplBuilder

core/src/main/java/io/grpc/internal/ServerImplBuilder.java:60–362  ·  view source on GitHub ↗

Default builder for io.grpc.Server instances, for usage in Transport implementations.

Source from the content-addressed store, hash-verified

58 * Default builder for {@link io.grpc.Server} instances, for usage in Transport implementations.
59 */
60public final class ServerImplBuilder extends ServerBuilder<ServerImplBuilder> {
61
62 private static final Logger log = Logger.getLogger(ServerImplBuilder.class.getName());
63
64 @DoNotCall("ClientTransportServersBuilder is required, use a constructor")
65 public static ServerBuilder<?> forPort(int port) {
66 throw new UnsupportedOperationException(
67 "ClientTransportServersBuilder is required, use a constructor");
68 }
69
70 // defaults
71 private static final ObjectPool<? extends Executor> DEFAULT_EXECUTOR_POOL =
72 SharedResourcePool.forResource(GrpcUtil.SHARED_CHANNEL_EXECUTOR);
73 private static final HandlerRegistry DEFAULT_FALLBACK_REGISTRY = new DefaultFallbackRegistry();
74 private static final DecompressorRegistry DEFAULT_DECOMPRESSOR_REGISTRY =
75 DecompressorRegistry.getDefaultInstance();
76 private static final CompressorRegistry DEFAULT_COMPRESSOR_REGISTRY =
77 CompressorRegistry.getDefaultInstance();
78 private static final long DEFAULT_HANDSHAKE_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(120);
79
80 // mutable state
81 final InternalHandlerRegistry.Builder registryBuilder =
82 new InternalHandlerRegistry.Builder();
83 final List<ServerTransportFilter> transportFilters = new ArrayList<>();
84 final List<ServerInterceptor> interceptors = new ArrayList<>();
85 private final List<ServerStreamTracer.Factory> streamTracerFactories = new ArrayList<>();
86 final List<MetricSink> metricSinks = new ArrayList<>();
87 private final ClientTransportServersBuilder clientTransportServersBuilder;
88 HandlerRegistry fallbackRegistry = DEFAULT_FALLBACK_REGISTRY;
89 ObjectPool<? extends Executor> executorPool = DEFAULT_EXECUTOR_POOL;
90 DecompressorRegistry decompressorRegistry = DEFAULT_DECOMPRESSOR_REGISTRY;
91 CompressorRegistry compressorRegistry = DEFAULT_COMPRESSOR_REGISTRY;
92 long handshakeTimeoutMillis = DEFAULT_HANDSHAKE_TIMEOUT_MILLIS;
93 Deadline.Ticker ticker = Deadline.getSystemTicker();
94 private boolean statsEnabled = true;
95 private boolean recordStartedRpcs = true;
96 private boolean recordFinishedRpcs = true;
97 private boolean recordRealTimeMetrics = false;
98 private boolean tracingEnabled = true;
99 @Nullable BinaryLog binlog;
100 InternalChannelz channelz = InternalChannelz.instance();
101 CallTracer.Factory callTracerFactory = CallTracer.getDefaultFactory();
102 @Nullable
103 ServerCallExecutorSupplier executorSupplier;
104
105 /**
106 * An interface to provide transport specific information for the server. This method
107 * is meant for Transport implementors and should not be used by normal users.
108 */
109 public interface ClientTransportServersBuilder {
110 InternalServer buildClientTransportServers(
111 List<? extends ServerStreamTracer.Factory> streamTracerFactories,
112 MetricRecorder metricRecorder);
113 }
114
115 /**
116 * Creates a new server builder with given transport servers provider.
117 */

Callers

nothing calls this directly

Calls 7

forResourceMethod · 0.95
getDefaultInstanceMethod · 0.95
getDefaultInstanceMethod · 0.95
getSystemTickerMethod · 0.95
instanceMethod · 0.95
getDefaultFactoryMethod · 0.95
getNameMethod · 0.65

Tested by

no test coverage detected