@Override public Future<Boolean> isHealthy(Channel channel) { // See if we've marked the channel as being non-usable first. if (channelIsMarkedAsBeingBroken(channel)) return channel.eventLoop().newSucceededFuture(Boolean.FALSE); // We haven't marked it broken, so fallback to the default channel health checker. return ChannelHealthChecker.ACTIVE.isHealthy(channel); }
public NettyHttpClient(ClientConfiguration configuration) { ThreadGroup threadGroup = new ThreadGroup("Netty RxS3 client"); AtomicInteger threadCounter = new AtomicInteger(); ThreadFactory threadFactory = r -> new Thread(threadGroup, r, "RxS3-client-worker" + threadCounter.getAndIncrement()); group = new NioEventLoopGroup(configuration.getWorkerThreadCount(), threadFactory); String[] s3LocationArray = configuration.getS3Location().trim().split(":"); s3Location = s3LocationArray[0]; int port = 80; if (s3LocationArray.length == 2) { port = Integer.parseInt(s3LocationArray[1]); } demultiplexer = new HandlerDemultiplexer(); Bootstrap bootstrap = new Bootstrap(); bootstrap.group(group) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .option(ChannelOption.SO_KEEPALIVE, true) .option(ChannelOption.TCP_NODELAY, true) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, configuration.getConnectionTimeoutMillis()) .channel(NioSocketChannel.class) .remoteAddress(s3Location, port); channelPool = new FixedChannelPool(bootstrap, new AbstractChannelPoolHandler() { HttpClientInitializer initializer = new HttpClientInitializer(demultiplexer); @Override public void channelCreated(Channel ch) { initializer.initChannel(ch); } }, ChannelHealthChecker.ACTIVE, FixedChannelPool.AcquireTimeoutAction.FAIL, configuration.getAcquireTimeoutMillis(), configuration.getMaxConnections(), configuration.getMaxPendingAcquires()); }
public ConnectionlessChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck) { super(bootstrap, handler, healthCheck); }
public ConnectionlessChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck, boolean releaseHealthCheck) { super(bootstrap, handler, healthCheck, releaseHealthCheck); }
ChannelPool newPool(Bootstrap b, ChannelPoolHandler handler, ChannelHealthChecker checker);