public HttpServerLifecycleChannelHandler() { super(new HttpServerLifecycleInboundChannelHandler(), new HttpServerLifecycleOutboundChannelHandler()); }
@Override public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception { // Close according to the specified close type. Channel parent = parentChannel(ctx); ConnectionCloseType type = ConnectionCloseType.fromChannel(parent); closeChannel(ctx, parent, type, promise); // Don't pass this event further down the pipeline. }
@Override public EventExecutor next() { return chooseWithLeastConns(); }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (isResponseHeaders(msg)) { // Update the request count attribute for this channel. requestCount++; if (isConnectionExpired(ctx)) { // Flag this channel to be closed after response is written. HttpChannelFlags.CLOSE_AFTER_RESPONSE.set(ctx); // with close of configured type. ConnectionCloseType.setForChannel(ctx.channel(), connectionCloseType); } } super.write(ctx, msg, promise); }
protected boolean isAlreadyClosing(Channel parentChannel) { // If already closing, then just return. // This will happen because close() is called a 2nd time after sending the goaway frame. if (HttpChannelFlags.CLOSING.get(parentChannel)) { return true; } else { HttpChannelFlags.CLOSING.set(parentChannel); return false; } }
@Override public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception { // Close according to the specified close type. ConnectionCloseType type = ConnectionCloseType.fromChannel(ctx.channel()); closeChannel(ctx, type, promise); // Don't pass this event further down the pipeline. }
protected void addHttp1Handlers(ChannelPipeline pipeline) { pipeline.addLast(HTTP_CODEC_HANDLER_NAME, createHttpServerCodec()); pipeline.addLast(new Http1ConnectionCloseHandler(connCloseDelay)); pipeline.addLast("conn_expiry_handler", new Http1ConnectionExpiryHandler(maxRequestsPerConnection, maxRequestsPerConnectionInBrownout, connectionExpiry)); }
protected int maxRequests(Channel ch) { if (HttpChannelFlags.IN_BROWNOUT.get(ch)) { return this.maxRequestsUnderBrownout; } else { return this.maxRequests; } } }
@Override public EventExecutorChooser newChooser(EventExecutor[] executors) { return new LeastConnsEventExecutorChooser(executors, groupMetrics); }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (isResponseHeaders(msg)) { // Update the request count attribute for this channel. requestCount++; if (isConnectionExpired(ctx)) { // Flag this channel to be closed after response is written. HttpChannelFlags.CLOSE_AFTER_RESPONSE.set(ctx); // with close of configured type. ConnectionCloseType.setForChannel(ctx.channel(), connectionCloseType); } } super.write(ctx, msg, promise); }
@Override public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception { // Close according to the specified close type. Channel parent = parentChannel(ctx); ConnectionCloseType type = ConnectionCloseType.fromChannel(parent); closeChannel(ctx, parent, type, promise); // Don't pass this event further down the pipeline. }
public HttpServerLifecycleChannelHandler() { super(new HttpServerLifecycleInboundChannelHandler(), new HttpServerLifecycleOutboundChannelHandler()); }
@Override public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception { // Close according to the specified close type. ConnectionCloseType type = ConnectionCloseType.fromChannel(ctx.channel()); closeChannel(ctx, type, promise); // Don't pass this event further down the pipeline. }
protected void addHttp1Handlers(ChannelPipeline pipeline) { pipeline.addLast(HTTP_CODEC_HANDLER_NAME, createHttpServerCodec()); pipeline.addLast(new Http1ConnectionCloseHandler(connCloseDelay)); pipeline.addLast("conn_expiry_handler", new Http1ConnectionExpiryHandler(maxRequestsPerConnection, maxRequestsPerConnectionInBrownout, connectionExpiry)); }
@Override public EventExecutor next() { return chooseWithLeastConns(); }
protected int maxRequests(Channel ch) { if (HttpChannelFlags.IN_BROWNOUT.get(ch)) { return this.maxRequestsUnderBrownout; } else { return this.maxRequests; } } }
@Override public EventExecutorChooser newChooser(EventExecutor[] executors) { return new LeastConnsEventExecutorChooser(executors, groupMetrics); }
protected boolean isAlreadyClosing(Channel parentChannel) { // If already closing, then just return. // This will happen because close() is called a 2nd time after sending the goaway frame. if (HttpChannelFlags.CLOSING.get(parentChannel)) { return true; } else { HttpChannelFlags.CLOSING.set(parentChannel); return false; } }