HttpServerHandler(ServerConfig config, GracefulShutdownSupport gracefulShutdownSupport, @Nullable HttpObjectEncoder responseEncoder, SessionProtocol protocol, @Nullable ProxiedAddresses proxiedAddresses) { assert protocol == H1 || protocol == H1C || protocol == H2; this.config = requireNonNull(config, "config"); this.gracefulShutdownSupport = requireNonNull(gracefulShutdownSupport, "gracefulShutdownSupport"); this.protocol = requireNonNull(protocol, "protocol"); this.responseEncoder = responseEncoder; this.proxiedAddresses = proxiedAddresses; unfinishedRequests = new IdentityHashMap<>(); accessLogWriter = config.accessLogWriter(); }
private void finishDoStop(CompletableFuture<Void> future) { // TODO(trustin): Add shutdownBlockingTaskExecutorOnStop // TODO(trustin): Count the pending blocking tasks and wait until it goes zero. if (!config.shutdownAccessLogWriterOnStop()) { future.complete(null); return; } config.accessLogWriter().shutdown().exceptionally(cause -> { logger.warn("Failed to close the {}:", AccessLogWriter.class.getSimpleName(), cause); return null; }).thenRunAsync(() -> future.complete(null), config.startStopExecutor()); }
@Override public String toString() { String strVal = this.strVal; if (strVal == null) { this.strVal = strVal = toString( getClass(), ports(), null, virtualHosts(), workerGroup(), shutdownWorkerGroupOnStop(), maxNumConnections(), idleTimeoutMillis(), defaultRequestTimeoutMillis(), defaultMaxRequestLength(), verboseResponses(), http2InitialConnectionWindowSize(), http2InitialStreamWindowSize(), http2MaxStreamsPerConnection(), http2MaxFrameSize(), http2MaxHeaderListSize(), http1MaxInitialLineLength(), http1MaxHeaderSize(), http1MaxChunkSize(), proxyProtocolMaxTlvSize(), gracefulShutdownQuietPeriod(), gracefulShutdownTimeout(), blockingTaskExecutor(), meterRegistry(), serviceLoggerPrefix(), accessLogWriter(), shutdownAccessLogWriterOnStop(), channelOptions(), childChannelOptions(), clientAddressSources(), clientAddressTrustedProxyFilter(), clientAddressFilter() ); } return strVal; }