@Override public void operationComplete(ChannelFuture future) throws Exception { Channel ch = future.channel(); logger.info("operationComplete channel closed for userId = " + _userId + ". Retrying." + " localAddress = " + ch.localAddress() + ", remoteAddress = " + ch.remoteAddress() ); _pool.release(ch); Future<Channel> f = _pool.acquire(); long now = 0; if (channelStatsCollectorLogger.isDebugEnabled()) { now = System.currentTimeMillis(); _channelStatsCollector.incrementNumChannelsRequested(); _channelStatsCollector.incrementNumChannelsAcquiredClosed(); } f.addListener(new ChannelAllocatedFutureListener(_httpTransport, _httpMethod, _simpleUri, _urlBindVariables, _headers, _content, _formParameters, _fileUploads, _dropResponse, _callback, _pool, now, _userId)); }
private AsyncTcpResponse executeByPool(TcpRequest request) throws InterruptedException, ExecutionException, IOException { InetSocketAddress address = new InetSocketAddress(request.getUri().getHost(), request.getUri().getPort()); FixedChannelPool pool = poolManager.getChannelPool(address); Future<Channel> future = pool.acquire().sync(); if (!future.isSuccess()) { log.debug(future.cause()); throw new ConnectTimeoutException(String.valueOf(future.cause())); } else { Channel channel = future.get(); ChannelFuture channelFuture; try { channelFuture = channel.writeAndFlush(request.getData()); } catch (Throwable e) { pool.release(channel); throw new IOException(e); } return new AsyncTcpResponse(channelFuture, request.getUri(), () -> { pool.release(channel); return true; }); } }
ch.close(); _pool.release(ch); Future<Channel> f = _pool.acquire(); long now = _allocateStartTimeMillis; if (channelStatsCollectorLogger.isDebugEnabled()) { _channelStatsCollector.incrementNumChannelsAcquiredFailed(); Future<Channel> f = _pool.acquire(); f.addListener(new ChannelAllocatedFutureListener(_httpTransport, _httpMethod, _simpleUri, _urlBindVariables, _headers, _content, _formParameters, _fileUploads, _dropResponse,
Future<Channel> f = pool.acquire();