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 class
FixedFastChannelPoolImpl.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 boolean
acquireConnectSemaphore()
int
acquiredChannelCount()
Returns the number of acquired channels that this pool thinks it has.void
close()
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)
int
getConnectedChannels()
int
getMinConnections()
io.netty.channel.pool.ChannelPoolHandler
handler()
Returns theChannelPoolHandler
that will be notified for the different pool actions.boolean
isClosing()
boolean
isHealthy()
protected FastFixedChannelPool.PoolChannelGroup
newPoolChannelGroup()
protected void
notifyGrowFailure(java.net.SocketAddress remoteAddress, java.lang.Throwable cause)
protected void
onConnect(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)
void
setMinConnections(int minConnections)
void
setMinConnections(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:
newPoolChannelGroup
in classFastFixedChannelPool
-
handler
public io.netty.channel.pool.ChannelPoolHandler handler()
Description copied from class:FastSimpleChannelPool
Returns theChannelPoolHandler
that will be notified for the different pool actions.- Specified by:
handler
in interfaceManagedChannelPool
- Overrides:
handler
in classFastSimpleChannelPool
- Returns:
- the
ChannelPoolHandler
that will be notified for the different pool actions
-
getConnectedChannels
public int getConnectedChannels()
- Specified by:
getConnectedChannels
in 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:
acquireConnectSemaphore
in classFastSimpleChannelPool
-
onConnect
protected void onConnect(io.netty.channel.Channel ch, io.netty.util.concurrent.Promise<io.netty.channel.Channel> promise)
- Overrides:
onConnect
in 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:FastFixedChannelPool
Initiate 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:
connectChannel
in 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:
isHealthy
in 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:
acquire
in interfaceio.netty.channel.pool.ChannelPool
- Overrides:
acquire
in 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:
release
in interfaceio.netty.channel.pool.ChannelPool
- Overrides:
release
in classFastFixedChannelPool
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceio.netty.channel.pool.ChannelPool
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classFastFixedChannelPool
-
closeFuture
public final io.netty.util.concurrent.Future<java.lang.Void> closeFuture()
- Specified by:
closeFuture
in interfaceManagedChannelPool
-
isClosing
public final boolean isClosing()
- Specified by:
isClosing
in interfaceManagedChannelPool
-
acquiredChannelCount
public int acquiredChannelCount()
Description copied from class:FastFixedChannelPool
Returns the number of acquired channels that this pool thinks it has.- Overrides:
acquiredChannelCount
in classFastFixedChannelPool
-
notifyGrowFailure
protected void notifyGrowFailure(java.net.SocketAddress remoteAddress, java.lang.Throwable cause)
-
-