public boolean get(ChannelHandlerContext ctx) { return get(ctx.channel()); } }
public boolean get(ChannelHandlerContext ctx) { return get(ctx.channel()); } }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { // Add header to tell client that they should close this connection. response.headers().set(HttpHeaderNames.CONNECTION, "close"); } } super.write(ctx, msg, promise); // Close the connection immediately after LastContent is written, rather than // waiting until the graceful-delay is up if this flag is set. if (msg instanceof LastHttpContent) { if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { promise.addListener(future -> { ctx.close(); }); } } }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { // Add header to tell client that they should close this connection. response.headers().set(HttpHeaderNames.CONNECTION, "close"); } } super.write(ctx, msg, promise); // Close the connection immediately after LastContent is written, rather than // waiting until the graceful-delay is up if this flag is set. if (msg instanceof LastHttpContent) { if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { promise.addListener(future -> { ctx.close(); }); } } }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { super.write(ctx, msg, promise); // Close the connection immediately after LastContent is written, rather than // waiting until the graceful-delay is up if this flag is set. if (isEndOfRequestResponse(msg)) { if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { promise.addListener(future -> { Channel parent = parentChannel(ctx); closeChannel(ctx, parent, ConnectionCloseType.fromChannel(ctx.channel()), ctx.newPromise()); }); } } }
protected boolean isAlreadyClosing(ChannelHandlerContext ctx) { // If already closing, then just return. if (HttpChannelFlags.CLOSING.get(ctx)) { return true; } else { HttpChannelFlags.CLOSING.set(ctx); HttpChannelFlags.CLOSE_AFTER_RESPONSE.set(ctx); return false; } } }
public boolean get(ChannelHandlerContext ctx) { return get(ctx.channel()); } }
protected int maxRequests(Channel ch) { if (HttpChannelFlags.IN_BROWNOUT.get(ch)) { return this.maxRequestsUnderBrownout; } else { return this.maxRequests; } } }
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 write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { // Add header to tell client that they should close this connection. response.headers().set(HttpHeaderNames.CONNECTION, "close"); } } super.write(ctx, msg, promise); // Close the connection immediately after LastContent is written, rather than // waiting until the graceful-delay is up if this flag is set. if (msg instanceof LastHttpContent) { if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { promise.addListener(future -> { ctx.close(); }); } } }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { super.write(ctx, msg, promise); // Close the connection immediately after LastContent is written, rather than // waiting until the graceful-delay is up if this flag is set. if (isEndOfRequestResponse(msg)) { if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { promise.addListener(future -> { Channel parent = parentChannel(ctx); closeChannel(ctx, parent, ConnectionCloseType.fromChannel(ctx.channel()), ctx.newPromise()); }); } } }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { super.write(ctx, msg, promise); // Close the connection immediately after LastContent is written, rather than // waiting until the graceful-delay is up if this flag is set. if (isEndOfRequestResponse(msg)) { if (HttpChannelFlags.CLOSE_AFTER_RESPONSE.get(ctx)) { promise.addListener(future -> { Channel parent = parentChannel(ctx); closeChannel(ctx, parent, ConnectionCloseType.fromChannel(ctx.channel()), ctx.newPromise()); }); } } }
protected int maxRequests(Channel ch) { if (HttpChannelFlags.IN_BROWNOUT.get(ch)) { return this.maxRequestsUnderBrownout; } else { return this.maxRequests; } } }
protected boolean isAlreadyClosing(ChannelHandlerContext ctx) { // If already closing, then just return. if (HttpChannelFlags.CLOSING.get(ctx)) { return true; } else { HttpChannelFlags.CLOSING.set(ctx); HttpChannelFlags.CLOSE_AFTER_RESPONSE.set(ctx); return false; } } }
protected boolean isAlreadyClosing(ChannelHandlerContext ctx) { // If already closing, then just return. if (HttpChannelFlags.CLOSING.get(ctx)) { return true; } else { HttpChannelFlags.CLOSING.set(ctx); HttpChannelFlags.CLOSE_AFTER_RESPONSE.set(ctx); return false; } } }
protected int maxRequests(Channel ch) { if (HttpChannelFlags.IN_BROWNOUT.get(ch)) { return this.maxRequestsUnderBrownout; } else { return this.maxRequests; } } }
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; } }
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; } }