Netty-based server implementation.
| 73 | * Netty-based server implementation. |
| 74 | */ |
| 75 | class NettyServer implements InternalServer, InternalWithLogId { |
| 76 | private static final Logger log = Logger.getLogger(InternalServer.class.getName()); |
| 77 | |
| 78 | private final InternalLogId logId; |
| 79 | private final List<? extends SocketAddress> addresses; |
| 80 | private final ChannelFactory<? extends ServerChannel> channelFactory; |
| 81 | private final Map<ChannelOption<?>, ?> channelOptions; |
| 82 | private final Map<ChannelOption<?>, ?> childChannelOptions; |
| 83 | private final ProtocolNegotiator protocolNegotiator; |
| 84 | private final int maxStreamsPerConnection; |
| 85 | private final ObjectPool<? extends EventLoopGroup> bossGroupPool; |
| 86 | private final ObjectPool<? extends EventLoopGroup> workerGroupPool; |
| 87 | private final boolean forceHeapBuffer; |
| 88 | private EventLoopGroup bossGroup; |
| 89 | private EventLoopGroup workerGroup; |
| 90 | private ServerListener listener; |
| 91 | private final ChannelGroup channelGroup; |
| 92 | private final boolean autoFlowControl; |
| 93 | private final int flowControlWindow; |
| 94 | private final int maxMessageSize; |
| 95 | private final int maxHeaderListSize; |
| 96 | private final int softLimitHeaderListSize; |
| 97 | private MetricRecorder metricRecorder; |
| 98 | private final long keepAliveTimeInNanos; |
| 99 | private final long keepAliveTimeoutInNanos; |
| 100 | private final long maxConnectionIdleInNanos; |
| 101 | private final long maxConnectionAgeInNanos; |
| 102 | private final long maxConnectionAgeGraceInNanos; |
| 103 | private final boolean permitKeepAliveWithoutCalls; |
| 104 | private final long permitKeepAliveTimeInNanos; |
| 105 | private final int maxRstCount; |
| 106 | private final long maxRstPeriodNanos; |
| 107 | private final Attributes eagAttributes; |
| 108 | private final ReferenceCounted sharedResourceReferenceCounter = |
| 109 | new SharedResourceReferenceCounter(); |
| 110 | private final List<? extends ServerStreamTracer.Factory> streamTracerFactories; |
| 111 | private final TransportTracer.Factory transportTracerFactory; |
| 112 | private final InternalChannelz channelz; |
| 113 | private volatile List<InternalInstrumented<SocketStats>> listenSocketStatsList = |
| 114 | Collections.emptyList(); |
| 115 | private volatile boolean terminated; |
| 116 | private final EventLoop bossExecutor; |
| 117 | |
| 118 | NettyServer( |
| 119 | List<? extends SocketAddress> addresses, |
| 120 | ChannelFactory<? extends ServerChannel> channelFactory, |
| 121 | Map<ChannelOption<?>, ?> channelOptions, |
| 122 | Map<ChannelOption<?>, ?> childChannelOptions, |
| 123 | ObjectPool<? extends EventLoopGroup> bossGroupPool, |
| 124 | ObjectPool<? extends EventLoopGroup> workerGroupPool, |
| 125 | boolean forceHeapBuffer, |
| 126 | ProtocolNegotiator protocolNegotiator, |
| 127 | List<? extends ServerStreamTracer.Factory> streamTracerFactories, |
| 128 | TransportTracer.Factory transportTracerFactory, |
| 129 | int maxStreamsPerConnection, |
| 130 | boolean autoFlowControl, |
| 131 | int flowControlWindow, |
| 132 | int maxMessageSize, |