Example usage for io.netty.channel.pool ChannelHealthChecker ACTIVE

List of usage examples for io.netty.channel.pool ChannelHealthChecker ACTIVE

Introduction

In this page you can find the example usage for io.netty.channel.pool ChannelHealthChecker ACTIVE.

Prototype

ChannelHealthChecker ACTIVE

To view the source code for io.netty.channel.pool ChannelHealthChecker ACTIVE.

Click Source Link

Document

ChannelHealthChecker implementation that checks if Channel#isActive() returns true .

Usage

From source file:com.linecorp.armeria.client.pool.DefaultKeyedChannelPool.java

License:Apache License

/**
 * Creates a new instance./*ww  w .  j  a  v a2  s .c om*/
 */
public DefaultKeyedChannelPool(EventLoop eventLoop, Function<K, Future<Channel>> channelFactory,
        KeyedChannelPoolHandler<K> channelPoolHandler) {
    this(eventLoop, channelFactory, ChannelHealthChecker.ACTIVE, channelPoolHandler, true);
}

From source file:reactor.ipc.netty.resources.PoolResources.java

License:Open Source License

/**
 * Create a capped {@link PoolResources} to provide automatically for {@link
 * ChannelPool}./*from   w  w  w .  j  a v a 2s .  co  m*/
 * <p>A Fixed {@link PoolResources} will open up to the given max connection value.
 * Further connections will be pending acquisition indefinitely.
 *
 * @param name the channel pool map name
 * @param maxConnections the maximum number of connections before starting pending
 * @param acquireTimeout the maximum time in millis to wait for aquiring
 *
 * @return a new {@link PoolResources} to provide automatically for {@link
 * ChannelPool}
 */
static PoolResources fixed(String name, int maxConnections, long acquireTimeout) {
    if (maxConnections != -1 && maxConnections <= 0) {
        throw new IllegalArgumentException("Max Connections value must be strictly " + "positive");
    }
    if (acquireTimeout != -1L && acquireTimeout < 0) {
        throw new IllegalArgumentException("Acquire Timeout value must " + "be " + "positive");
    }
    return new DefaultPoolResources(name,
            (bootstrap, handler) -> new FixedChannelPool(bootstrap, handler, ChannelHealthChecker.ACTIVE,
                    FixedChannelPool.AcquireTimeoutAction.FAIL, acquireTimeout, maxConnections,
                    Integer.MAX_VALUE));

}