Package com.linkedin.alpini.netty4.pool
Class FixedChannelPoolImpl
- java.lang.Object
-
- com.linkedin.alpini.netty4.pool.EspressoSimpleChannelPool
-
- com.linkedin.alpini.netty4.pool.EspressoFixedChannelPool
-
- com.linkedin.alpini.netty4.pool.FixedChannelPoolImpl
-
- All Implemented Interfaces:
ChannelPoolWithStats,ManagedChannelPool,io.netty.channel.pool.ChannelPool,java.io.Closeable,java.lang.AutoCloseable
public class FixedChannelPoolImpl extends EspressoFixedChannelPool implements ManagedChannelPool
Created by acurtis on 5/8/18.
-
-
Constructor Summary
Constructors Constructor Description FixedChannelPoolImpl(io.netty.bootstrap.Bootstrap bootstrap, io.netty.channel.pool.ChannelPoolHandler handler, io.netty.channel.pool.ChannelHealthChecker healthCheck, io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int minConnections, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck, boolean lastRecentUsed)FixedChannelPoolImpl(io.netty.bootstrap.Bootstrap bootstrap, io.netty.channel.pool.ChannelPoolHandler handler, io.netty.channel.pool.ChannelHealthChecker healthCheck, io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int minConnections, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck, boolean lastRecentUsed, java.util.function.BooleanSupplier useQueueSizeForAcquiredChannelCount)FixedChannelPoolImpl(io.netty.bootstrap.Bootstrap bootstrap, io.netty.channel.pool.ChannelPoolHandler handler, io.netty.channel.pool.ChannelHealthChecker healthCheck, io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, java.util.function.IntSupplier minConnections, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck, boolean lastRecentUsed)FixedChannelPoolImpl(io.netty.bootstrap.Bootstrap bootstrap, io.netty.channel.pool.ChannelPoolHandler handler, io.netty.channel.pool.ChannelHealthChecker healthCheck, io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, java.util.function.IntSupplier minConnections, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck, boolean lastRecentUsed, java.util.function.BooleanSupplier useQueueSizeForAcquiredChannelCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.netty.util.concurrent.Future<io.netty.channel.Channel>acquire(io.netty.util.concurrent.Promise<io.netty.channel.Channel> promise)intacquiredChannelCount()Returns the number of acquired channels that this pool thinks it has.voidclose()io.netty.util.concurrent.Future<java.lang.Void>closeFuture()protected io.netty.channel.ChannelFutureconnectChannel(io.netty.bootstrap.Bootstrap bs)Bootstrap a newChannel.protected io.netty.channel.ChannelFutureconnectChannel0(io.netty.bootstrap.Bootstrap bs)intgetConnectedChannels()intgetMinConnections()io.netty.channel.pool.ChannelPoolHandlerhandler()Returns theChannelPoolHandlerthat will be notified for the different pool actions.booleanisClosing()booleanisHealthy()java.lang.Stringname()protected voidnotifyGrowFailure(java.net.SocketAddress remoteAddress, java.lang.Throwable cause)io.netty.util.concurrent.Future<java.lang.Void>release(io.netty.channel.Channel channel, io.netty.util.concurrent.Promise<java.lang.Void> promise)voidsetMinConnections(int minConnections)voidsetMinConnections(java.util.function.IntSupplier minConnections)-
Methods inherited from class com.linkedin.alpini.netty4.pool.EspressoFixedChannelPool
closeAsync, getAcquiredChannelCount, getMaxConnections, getMaxPendingAcquires, getPendingAcquireCount, incrementAcquiredChannelCount, isClosed, isPoolClosed
-
Methods inherited from class com.linkedin.alpini.netty4.pool.EspressoSimpleChannelPool
acquire, bootstrap, getAvailableChannels, healthChecker, offerChannel, pollChannel, release, releaseHealthCheck
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.linkedin.alpini.netty4.pool.ChannelPoolWithStats
getAcquiredChannelCount, getMaxConnections, getMaxPendingAcquires, getPendingAcquireCount
-
Methods inherited from interface com.linkedin.alpini.netty4.pool.ManagedChannelPool
getActiveStreamsLimitReachedCount, getChannelReusePoolSize, getCurrentStreamChannelsReused, getH2ActiveConnections, getHttp2ChannelGroup, getTotalAcquireRetries, getTotalActiveStreamChannels, getTotalActiveStreams, getTotalStreamChannelsReused, getTotalStreamCreations, isClosed
-
-
-
-
Constructor Detail
-
FixedChannelPoolImpl
public FixedChannelPoolImpl(@Nonnull io.netty.bootstrap.Bootstrap bootstrap, @Nonnull io.netty.channel.pool.ChannelPoolHandler handler, @Nonnull io.netty.channel.pool.ChannelHealthChecker healthCheck, @Nonnull io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, @Nonnull java.util.function.IntSupplier minConnections, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck, boolean lastRecentUsed)
-
FixedChannelPoolImpl
public FixedChannelPoolImpl(@Nonnull io.netty.bootstrap.Bootstrap bootstrap, @Nonnull io.netty.channel.pool.ChannelPoolHandler handler, @Nonnull io.netty.channel.pool.ChannelHealthChecker healthCheck, @Nonnull io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int minConnections, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck, boolean lastRecentUsed)
-
FixedChannelPoolImpl
public FixedChannelPoolImpl(@Nonnull io.netty.bootstrap.Bootstrap bootstrap, @Nonnull io.netty.channel.pool.ChannelPoolHandler handler, @Nonnull io.netty.channel.pool.ChannelHealthChecker healthCheck, @Nonnull io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, int minConnections, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck, boolean lastRecentUsed, @Nonnull java.util.function.BooleanSupplier useQueueSizeForAcquiredChannelCount)
-
FixedChannelPoolImpl
public FixedChannelPoolImpl(@Nonnull io.netty.bootstrap.Bootstrap bootstrap, @Nonnull io.netty.channel.pool.ChannelPoolHandler handler, @Nonnull io.netty.channel.pool.ChannelHealthChecker healthCheck, @Nonnull io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction action, long acquireTimeoutMillis, @Nonnull java.util.function.IntSupplier minConnections, int maxConnections, int maxPendingAcquires, boolean releaseHealthCheck, boolean lastRecentUsed, @Nonnull java.util.function.BooleanSupplier useQueueSizeForAcquiredChannelCount)
-
-
Method Detail
-
name
public java.lang.String name()
- Specified by:
namein interfaceChannelPoolWithStats- Overrides:
namein classEspressoFixedChannelPool
-
handler
public io.netty.channel.pool.ChannelPoolHandler handler()
Description copied from class:EspressoSimpleChannelPoolReturns theChannelPoolHandlerthat will be notified for the different pool actions.- Specified by:
handlerin interfaceManagedChannelPool- Overrides:
handlerin classEspressoSimpleChannelPool- Returns:
- the
ChannelPoolHandlerthat will be notified for the different pool actions
-
getConnectedChannels
public int getConnectedChannels()
- Specified by:
getConnectedChannelsin interfaceManagedChannelPool
-
setMinConnections
public void setMinConnections(int minConnections)
-
setMinConnections
public void setMinConnections(@Nonnull java.util.function.IntSupplier minConnections)
-
getMinConnections
public int getMinConnections()
-
connectChannel0
protected io.netty.channel.ChannelFuture connectChannel0(io.netty.bootstrap.Bootstrap bs)
-
connectChannel
protected io.netty.channel.ChannelFuture connectChannel(io.netty.bootstrap.Bootstrap bs)
Description copied from class:EspressoSimpleChannelPoolBootstrap a newChannel. The default implementation usesBootstrap.connect(), sub-classes may override this.The
Bootstrapthat is passed in here is cloned viaBootstrap.clone(), so it is safe to modify.- Overrides:
connectChannelin classEspressoSimpleChannelPool
-
isHealthy
public boolean isHealthy()
- Specified by:
isHealthyin interfaceManagedChannelPool
-
acquire
public io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire(io.netty.util.concurrent.Promise<io.netty.channel.Channel> promise)
- Specified by:
acquirein interfaceio.netty.channel.pool.ChannelPool- Overrides:
acquirein classEspressoFixedChannelPool
-
release
public io.netty.util.concurrent.Future<java.lang.Void> release(io.netty.channel.Channel channel, io.netty.util.concurrent.Promise<java.lang.Void> promise)- Specified by:
releasein interfaceio.netty.channel.pool.ChannelPool- Overrides:
releasein classEspressoFixedChannelPool
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceio.netty.channel.pool.ChannelPool- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classEspressoFixedChannelPool
-
closeFuture
public final io.netty.util.concurrent.Future<java.lang.Void> closeFuture()
- Specified by:
closeFuturein interfaceManagedChannelPool
-
isClosing
public final boolean isClosing()
- Specified by:
isClosingin interfaceManagedChannelPool
-
acquiredChannelCount
public int acquiredChannelCount()
Description copied from class:EspressoFixedChannelPoolReturns the number of acquired channels that this pool thinks it has.- Overrides:
acquiredChannelCountin classEspressoFixedChannelPool
-
notifyGrowFailure
protected void notifyGrowFailure(java.net.SocketAddress remoteAddress, java.lang.Throwable cause)
-
-