List of usage examples for io.netty.channel.pool FixedChannelPool FixedChannelPool
public FixedChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler, ChannelHealthChecker healthCheck, AcquireTimeoutAction action, final long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires)
From source file:com.eucalyptus.util.async.AsyncRequestChannelPoolMap.java
License:Open Source License
@Override protected SimpleChannelPool newPool(final ChannelPoolKey key) { final Bootstrap bootstrap = key.bootstrap.remoteAddress(key.address); final ChannelPoolHandler handler = new AsyncRequestsChannelPoolHandler(key.initializer); final ChannelHealthChecker checker = new AsyncRequestsChannelHealthChecker(); if (key.size <= 0) { return new SimpleChannelPool(bootstrap, handler, checker); } else {/*from ww w .j av a 2 s . com*/ return new FixedChannelPool(bootstrap, handler, checker, FixedChannelPool.AcquireTimeoutAction.FAIL, MoreObjects.firstNonNull(StackConfiguration.CLIENT_HTTP_POOL_ACQUIRE_TIMEOUT, 60_000L), key.size, Integer.MAX_VALUE); } }
From source file:reactor.ipc.netty.resources.PoolResources.java
License:Open Source License
/** * Create a capped {@link PoolResources} to provide automatically for {@link * ChannelPool}./* ww w. j a v a2s.com*/ * <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)); }