@Override protected ChannelPool newPool(RequestKey key) { Bootstrap newBootstrap = bootstrap.clone(group); newBootstrap.remoteAddress(key.getRemoteAddress()); AbstractChannelPoolHandler channelPoolHandler = newPoolHandler(key); return new SimpleChannelPool( newBootstrap, channelPoolHandler ); } };
@Override protected P newPool(K key) { return (P) new SimpleChannelPool(bootstrap, handler); } }
@Override public ChannelPool createChannelPool(InetSocketAddress key) { return new SimpleChannelPool(getBootstrap().remoteAddress(key), channelPoolHandler); }
public XioConnectionPool(Bootstrap bootstrap, AsyncRetryLoopFactory retryLoopFactory) { Preconditions.checkNotNull(bootstrap); this.retryLoopFactory = Preconditions.checkNotNull(retryLoopFactory); handler = bootstrap.config().handler(); eventLoopGroup = bootstrap.config().group(); simpleChannelPool = new SimpleChannelPool(bootstrap, channelPoolHandler, channelHealthChecker); }
public HttpOrHttp2ChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, int maxConcurrency, NettyConfiguration configuration) { this.simpleChannelPool = new SimpleChannelPool(bootstrap, handler); this.maxConcurrency = maxConcurrency; this.eventLoop = bootstrap.config().group().next(); this.configuration = configuration; }
@Override protected ChannelPool newPool(RequestKey key) { Bootstrap newBootstrap = bootstrap.clone(group); newBootstrap.remoteAddress(key.getRemoteAddress()); AbstractChannelPoolHandler channelPoolHandler = newPoolHandler(key); return new SimpleChannelPool( newBootstrap, channelPoolHandler ); } };
@Override protected ChannelPool newPool(RequestKey key) { Bootstrap newBootstrap = bootstrap.clone(group); newBootstrap.remoteAddress(key.getRemoteAddress()); AbstractChannelPoolHandler channelPoolHandler = newPoolHandler(key); return new SimpleChannelPool( newBootstrap, channelPoolHandler ); } };
@Override protected ChannelPool newPool(HttpChannelKey key) { Bootstrap bootstrap = new Bootstrap() .remoteAddress(key.host, key.port) .group(key.execution.getEventLoop()) .channel(TransportDetector.getSocketChannelImpl()) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, (int) key.connectTimeout.toMillis()) .option(ChannelOption.ALLOCATOR, spec.byteBufAllocator) .option(ChannelOption.AUTO_READ, false) .option(ChannelOption.SO_KEEPALIVE, isPooling()); if (isPooling()) { InstrumentedChannelPoolHandler channelPoolHandler = getPoolingHandler(key); hostStats.put(key.host, channelPoolHandler); CleanClosingFixedChannelPool channelPool = new CleanClosingFixedChannelPool(bootstrap, channelPoolHandler, getPoolSize(), getPoolQueueSize()); ((ExecControllerInternal) key.execution.getController()).onClose(() -> { remove(key); channelPool.closeCleanly(); }); return channelPool; } else { InstrumentedChannelPoolHandler channelPoolHandler = getSimpleHandler(key); hostStats.put(key.host, channelPoolHandler); return new SimpleChannelPool(bootstrap, channelPoolHandler, ALWAYS_UNHEALTHY); } } };
private ChannelPool createChannelPool(Bootstrap bootstrap, ChannelPipelineInitializer handler) { // Create a simple channel pool for pooling raw TCP connections to the service. ChannelPool channelPool = new SimpleChannelPool(bootstrap, handler); // Wrap the channel pool such that the ChannelAttributeKey.CLOSE_ON_RELEASE flag is honored. channelPool = new HonorCloseOnReleaseChannelPool(channelPool); // Wrap the channel pool such that HTTP 2 channels won't be released to the underlying pool while they're still in use. channelPool = new HttpOrHttp2ChannelPool(channelPool, bootstrap, configuration.maxConnections(), configuration); // Wrap the channel pool such that we remove request-specific handlers with each request. channelPool = new HandlerRemovingChannelPool(channelPool); // Wrap the channel pool such that an individual channel can only be released to the underlying pool once. channelPool = new ReleaseOnceChannelPool(channelPool); return channelPool; }
@Override protected ChannelPool newPool(Endpoint key) { if(key.isProxied()) { return new ProxiedChannelPool(bootstrap.clone().remoteAddress(new NoResolvingSocketAddress(key.address())), handler(key), key.asProxied().proxy(),checker); }else { return new SimpleChannelPool(bootstrap.clone().remoteAddress(key.address().host(),key.address().port()), handler(key),checker); } }