Package com.linkedin.alpini.netty4.pool
Class FixedFastChannelPoolImpl
- java.lang.Object
-
- com.linkedin.alpini.netty4.pool.FastSimpleChannelPool
-
- com.linkedin.alpini.netty4.pool.FastFixedChannelPool
-
- com.linkedin.alpini.netty4.pool.FixedFastChannelPoolImpl
-
- All Implemented Interfaces:
ChannelPoolWithStats,ManagedChannelPool,io.netty.channel.pool.ChannelPool,java.io.Closeable,java.lang.AutoCloseable
public class FixedFastChannelPoolImpl extends FastFixedChannelPool implements ManagedChannelPool
Created by acurtis on 5/8/18.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classFixedFastChannelPoolImpl.FixedPoolChannelGroup-
Nested classes/interfaces inherited from class com.linkedin.alpini.netty4.pool.FastFixedChannelPool
FastFixedChannelPool.PoolChannelGroup
-
-
Field Summary
-
Fields inherited from class com.linkedin.alpini.netty4.pool.FastFixedChannelPool
_channelGroup
-
Fields inherited from class com.linkedin.alpini.netty4.pool.FastSimpleChannelPool
_immediateEventExecutor
-
-
Constructor Summary
Constructors Constructor Description FixedFastChannelPoolImpl(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, int connectConcurrency)FixedFastChannelPoolImpl(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, int connectConcurrency, java.util.function.BooleanSupplier useQueueSizeForAcquiredChannelCount)FixedFastChannelPoolImpl(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, int connectConcurrency)FixedFastChannelPoolImpl(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, int connectConcurrency, 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)protected booleanacquireConnectSemaphore()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.util.concurrent.Future<io.netty.channel.Channel>connectChannel(io.netty.bootstrap.Bootstrap bs, io.netty.util.concurrent.Promise<io.netty.channel.Channel> promise)Initiate establishing a new connection with the provided bootstrap.protected io.netty.util.concurrent.Future<io.netty.channel.Channel>connectChannel0(io.netty.bootstrap.Bootstrap bs, io.netty.util.concurrent.Promise<io.netty.channel.Channel> promise)intgetConnectedChannels()intgetMinConnections()io.netty.channel.pool.ChannelPoolHandlerhandler()Returns theChannelPoolHandlerthat will be notified for the different pool actions.booleanisClosing()booleanisHealthy()protected FastFixedChannelPool.PoolChannelGroupnewPoolChannelGroup()protected voidnotifyGrowFailure(java.net.SocketAddress remoteAddress, java.lang.Throwable cause)protected voidonConnect(io.netty.channel.Channel ch, io.netty.util.concurrent.Promise<io.netty.channel.Channel> promise)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.FastFixedChannelPool
closeAsync, getAcquiredChannelCount, getMaxConnections, getMaxPendingAcquires, getPendingAcquireCount, isClosed, isPoolClosed, name, setMaxConnections
-
Methods inherited from class com.linkedin.alpini.netty4.pool.FastSimpleChannelPool
acquire, addWaiter, bootstrap, bootstrapChannel, closeChannel, connectInProgress, getAvailableChannels, healthChecker, offerChannel, pollChannel, release, releaseConnectSemaphore, 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, name
-
Methods inherited from interface com.linkedin.alpini.netty4.pool.ManagedChannelPool
getActiveStreamsLimitReachedCount, getChannelReusePoolSize, getCurrentStreamChannelsReused, getH2ActiveConnections, getHttp2ChannelGroup, getTotalAcquireRetries, getTotalActiveStreamChannels, getTotalActiveStreams, getTotalStreamChannelsReused, getTotalStreamCreations, isClosed
-
-
-
-
Constructor Detail
-
FixedFastChannelPoolImpl
public FixedFastChannelPoolImpl(@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, int connectConcurrency)
-
FixedFastChannelPoolImpl
public FixedFastChannelPoolImpl(@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, int connectConcurrency)
-
FixedFastChannelPoolImpl
public FixedFastChannelPoolImpl(@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, int connectConcurrency, @Nonnull java.util.function.BooleanSupplier useQueueSizeForAcquiredChannelCount)
-
FixedFastChannelPoolImpl
public FixedFastChannelPoolImpl(@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, int connectConcurrency, @Nonnull java.util.function.BooleanSupplier useQueueSizeForAcquiredChannelCount)
-
-
Method Detail
-
newPoolChannelGroup
protected FastFixedChannelPool.PoolChannelGroup newPoolChannelGroup()
- Overrides:
newPoolChannelGroupin classFastFixedChannelPool
-
handler
public io.netty.channel.pool.ChannelPoolHandler handler()
Description copied from class:FastSimpleChannelPoolReturns theChannelPoolHandlerthat will be notified for the different pool actions.- Specified by:
handlerin interfaceManagedChannelPool- Overrides:
handlerin classFastSimpleChannelPool- 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()
-
acquireConnectSemaphore
protected boolean acquireConnectSemaphore()
- Overrides:
acquireConnectSemaphorein classFastSimpleChannelPool
-
onConnect
protected void onConnect(io.netty.channel.Channel ch, io.netty.util.concurrent.Promise<io.netty.channel.Channel> promise)- Overrides:
onConnectin classFastSimpleChannelPool
-
connectChannel
protected io.netty.util.concurrent.Future<io.netty.channel.Channel> connectChannel(io.netty.bootstrap.Bootstrap bs, io.netty.util.concurrent.Promise<io.netty.channel.Channel> promise)Description copied from class:FastFixedChannelPoolInitiate establishing a new connection with the provided bootstrap. This implementation attempts to not exceed a preset number of max connections by storing deferred connections that would have caused the number of connections to be exceeded in the _pendingConnect queue. As connections are established, they are added to _channelGroup.- Overrides:
connectChannelin classFastFixedChannelPool- Parameters:
bs- Channel Bootstrappromise- Promise to complete with result of Bootstrap connect- Returns:
- the promise
-
connectChannel0
protected io.netty.util.concurrent.Future<io.netty.channel.Channel> connectChannel0(io.netty.bootstrap.Bootstrap bs, io.netty.util.concurrent.Promise<io.netty.channel.Channel> promise)
-
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 classFastFixedChannelPool
-
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 classFastFixedChannelPool
-
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 classFastFixedChannelPool
-
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:FastFixedChannelPoolReturns the number of acquired channels that this pool thinks it has.- Overrides:
acquiredChannelCountin classFastFixedChannelPool
-
notifyGrowFailure
protected void notifyGrowFailure(java.net.SocketAddress remoteAddress, java.lang.Throwable cause)
-
-