@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { AsyncPool<Channel> pool = ctx.channel().attr(CHANNEL_POOL_ATTR_KEY).getAndSet(null); if (pool != null) { // TODO do all exceptions mean we should get rid of the channel? pool.dispose(ctx.channel()); } }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { AsyncPool<Channel> pool = ctx.channel().attr(CHANNEL_POOL_ATTR_KEY).getAndSet(null); if (pool != null) { // TODO do all exceptions mean we should get rid of the channel? pool.dispose(ctx.channel()); } }
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { AsyncPool<Channel> pool = ctx.channel().attr(CHANNEL_POOL_ATTR_KEY).getAndSet(null); if (pool != null) { pool.dispose(ctx.channel()); } } }
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { AsyncPool<Channel> pool = ctx.channel().attr(CHANNEL_POOL_ATTR_KEY).getAndSet(null); if (pool != null) { pool.dispose(ctx.channel()); } } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg == CHANNEL_RELEASE_SIGNAL) { AsyncPool<Channel> pool = ctx.channel().attr(CHANNEL_POOL_ATTR_KEY).getAndSet(null); if (pool != null) { pool.put(ctx.channel()); } } else if (msg == CHANNEL_DESTROY_SIGNAL) { AsyncPool<Channel> pool = ctx.channel().attr(CHANNEL_POOL_ATTR_KEY).getAndSet(null); if (pool != null) { pool.dispose(ctx.channel()); } } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { AsyncPool<Channel> pool = ctx.channel().attr(CHANNEL_POOL_ATTR_KEY).getAndSet(null); if (pool != null) { RestResponse restResponse = (RestResponse) msg; List<String> connectionTokens = restResponse.getHeaderValues("connection"); if (connectionTokens != null) { for (String token: connectionTokens) { if ("close".equalsIgnoreCase(token)) { pool.dispose(ctx.channel()); return; } } } pool.put(ctx.channel()); } }
if (pool1 != null) pool1.dispose(channel);
if (pool != null) pool.dispose(channel);