@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 isConnectionExpired(ChannelHandlerContext ctx) { boolean expired = requestCount >= maxRequests(ctx.channel()) || System.currentTimeMillis() > connectionExpiryTime; if (expired) { long lifetime = System.currentTimeMillis() - connectionStartTime; LOG.info("Connection is expired. requestCount={}, lifetime={}, {}", requestCount, lifetime, ChannelUtils.channelInfoForLogging(ctx.channel())); } return expired; }
@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 isConnectionExpired(ChannelHandlerContext ctx) { boolean expired = requestCount >= maxRequests(ctx.channel()) || System.currentTimeMillis() > connectionExpiryTime; if (expired) { long lifetime = System.currentTimeMillis() - connectionStartTime; LOG.info("Connection is expired. requestCount={}, lifetime={}, {}", requestCount, lifetime, ChannelUtils.channelInfoForLogging(ctx.channel())); } return expired; }
@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 isConnectionExpired(ChannelHandlerContext ctx) { boolean expired = requestCount >= maxRequests(ctx.channel()) || System.currentTimeMillis() > connectionExpiryTime; if (expired) { long lifetime = System.currentTimeMillis() - connectionStartTime; LOG.info("Connection is expired. requestCount={}, lifetime={}, {}", requestCount, lifetime, ChannelUtils.channelInfoForLogging(ctx.channel())); } return expired; }