Java 类io.netty.channel.pool.ChannelHealthChecker 实例源码

项目:riposte    文件:StreamingAsyncHttpClient.java   
@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);
}
项目:RxS3    文件:NettyHttpClient.java   
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());
}
项目:async-gamequery-lib    文件:ConnectionlessChannelPool.java   
public ConnectionlessChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck) {
    super(bootstrap, handler, healthCheck);
}
项目:async-gamequery-lib    文件:ConnectionlessChannelPool.java   
public ConnectionlessChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck, boolean releaseHealthCheck) {
    super(bootstrap, handler, healthCheck, releaseHealthCheck);
}
项目:reactor-netty    文件:DefaultPoolResources.java   
ChannelPool newPool(Bootstrap b,
ChannelPoolHandler handler,
ChannelHealthChecker checker);