Package com.linkedin.alpini.netty4.pool
Class FixedChannelPoolFactory
- java.lang.Object
-
- com.linkedin.alpini.netty4.pool.FixedChannelPoolFactory
-
- All Implemented Interfaces:
ChannelPoolFactory
,io.netty.channel.pool.ChannelHealthChecker
public class FixedChannelPoolFactory extends java.lang.Object implements ChannelPoolFactory, io.netty.channel.pool.ChannelHealthChecker
This factory constructs instances ofFixedChannelPool
for theChannelPoolManager
.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.function.BooleanSupplier
_useQueueSizeForAcquiredChannelCount
protected boolean
_usingFastPool
-
Constructor Summary
Constructors Constructor Description FixedChannelPoolFactory(io.netty.bootstrap.Bootstrap bootstrap, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires, boolean releaseHeathCheck, long healthCheckIntervalMillis, io.netty.channel.pool.ChannelHealthChecker channelHealthChecker, CallTracker healthCheckerTracker)
FixedChannelPoolFactory(io.netty.bootstrap.Bootstrap bootstrap, long acquireTimeoutMillis, int maxConnections, int maxPendingAcquires, boolean releaseHeathCheck, long healthCheckIntervalMillis, io.netty.channel.pool.ChannelHealthChecker channelHealthChecker, java.util.function.Function<java.net.SocketAddress,CallTracker> healthCheckerTracker)
FixedChannelPoolFactory(io.netty.bootstrap.Bootstrap bootstrap, long acquireTimeoutMillis, int minConnections, int maxConnections, int maxPendingAcquires, boolean releaseHeathCheck, long healthCheckIntervalMillis, io.netty.channel.pool.ChannelHealthChecker channelHealthChecker, java.util.function.Function<java.net.SocketAddress,CallTracker> healthCheckerTracker)
FixedChannelPoolFactory(io.netty.bootstrap.Bootstrap bootstrap, long acquireTimeoutMillis, java.util.function.IntSupplier minConnections, java.util.function.IntSupplier maxConnections, java.util.function.IntSupplier maxPendingAcquires, boolean releaseHeathCheck, java.util.function.LongSupplier healthCheckIntervalMillis, io.netty.channel.pool.ChannelHealthChecker channelHealthChecker, java.util.function.Function<java.net.SocketAddress,CallTracker> healthCheckerTracker)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ManagedChannelPool
construct(ChannelPoolManager manager, io.netty.channel.pool.ChannelPoolHandler handler, io.netty.channel.EventLoopGroup eventLoop, java.net.InetSocketAddress address)
Constructs a new ChannelPool which must connect to the specifiedaddress
.protected ManagedChannelPool
construct(io.netty.bootstrap.Bootstrap bootstrap, io.netty.channel.pool.ChannelPoolHandler channelPoolHandler, io.netty.channel.pool.ChannelHealthChecker healthChecker, io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction acquireTimeoutAction, java.util.function.IntSupplier minConnections, int maxConnections, boolean releaseHeathCheck)
long
getAcquireTimeoutMillis()
protected static <T extends io.netty.channel.pool.ChannelPoolHandler>
TgetChannelPoolHandler(io.netty.channel.Channel ch)
long
getHealthCheckIntervalMillis()
int
getMaxConnections()
int
getMaxPendingAcquires()
int
getMinConnections()
io.netty.util.concurrent.Future<java.lang.Boolean>
isHealthy(io.netty.channel.Channel channel)
boolean
isUsingFastPool()
void
setAcquireTimeoutAction(io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction action)
void
setHealthCheckIntervalMillis(long healthCheckIntervalMillis)
void
setHealthCheckIntervalMillis(java.util.function.LongSupplier healthCheckIntervalMillis)
void
setMinConnections(int minConnections)
void
setMinConnections(java.util.function.IntSupplier minConnections)
void
setUseQueueSizeForAcquiredChannelCount(java.util.function.BooleanSupplier useQueueSizeForAcquiredChannelCount)
void
setUsingFastPool(boolean usingFastPool)
-
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.ChannelPoolFactory
setHttp2PingSendHandlerFunction
-
-
-
-
Constructor Detail
-
FixedChannelPoolFactory
public FixedChannelPoolFactory(@Nonnull io.netty.bootstrap.Bootstrap bootstrap, @Nonnegative long acquireTimeoutMillis, @Nonnegative int maxConnections, @Nonnegative int maxPendingAcquires, boolean releaseHeathCheck, @Nonnegative long healthCheckIntervalMillis, @Nonnull io.netty.channel.pool.ChannelHealthChecker channelHealthChecker, @Nullable CallTracker healthCheckerTracker)
-
FixedChannelPoolFactory
public FixedChannelPoolFactory(@Nonnull io.netty.bootstrap.Bootstrap bootstrap, @Nonnegative long acquireTimeoutMillis, @Nonnegative int maxConnections, @Nonnegative int maxPendingAcquires, boolean releaseHeathCheck, @Nonnegative long healthCheckIntervalMillis, @Nonnull io.netty.channel.pool.ChannelHealthChecker channelHealthChecker, @Nullable java.util.function.Function<java.net.SocketAddress,CallTracker> healthCheckerTracker)
-
FixedChannelPoolFactory
public FixedChannelPoolFactory(@Nonnull io.netty.bootstrap.Bootstrap bootstrap, @Nonnegative long acquireTimeoutMillis, @Nonnegative int minConnections, @Nonnegative int maxConnections, @Nonnegative int maxPendingAcquires, boolean releaseHeathCheck, @Nonnegative long healthCheckIntervalMillis, @Nonnull io.netty.channel.pool.ChannelHealthChecker channelHealthChecker, @Nullable java.util.function.Function<java.net.SocketAddress,CallTracker> healthCheckerTracker)
-
FixedChannelPoolFactory
public FixedChannelPoolFactory(@Nonnull io.netty.bootstrap.Bootstrap bootstrap, @Nonnegative long acquireTimeoutMillis, @Nonnull java.util.function.IntSupplier minConnections, @Nonnull java.util.function.IntSupplier maxConnections, @Nonnull java.util.function.IntSupplier maxPendingAcquires, boolean releaseHeathCheck, @Nonnull java.util.function.LongSupplier healthCheckIntervalMillis, @Nonnull io.netty.channel.pool.ChannelHealthChecker channelHealthChecker, @Nullable java.util.function.Function<java.net.SocketAddress,CallTracker> healthCheckerTracker)
-
-
Method Detail
-
getChannelPoolHandler
protected static <T extends io.netty.channel.pool.ChannelPoolHandler> T getChannelPoolHandler(@Nonnull io.netty.channel.Channel ch)
-
setUsingFastPool
public void setUsingFastPool(boolean usingFastPool)
-
isUsingFastPool
public boolean isUsingFastPool()
-
setUseQueueSizeForAcquiredChannelCount
public void setUseQueueSizeForAcquiredChannelCount(@Nonnull java.util.function.BooleanSupplier useQueueSizeForAcquiredChannelCount)
-
setMinConnections
public void setMinConnections(@Nonnegative int minConnections)
-
setAcquireTimeoutAction
public void setAcquireTimeoutAction(@Nonnull io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction action)
-
setMinConnections
public void setMinConnections(@Nonnull java.util.function.IntSupplier minConnections)
-
getMinConnections
public int getMinConnections()
-
getMaxConnections
public int getMaxConnections()
-
getMaxPendingAcquires
public int getMaxPendingAcquires()
-
getAcquireTimeoutMillis
public long getAcquireTimeoutMillis()
-
construct
@Nonnull public ManagedChannelPool construct(@Nonnull ChannelPoolManager manager, @Nonnull io.netty.channel.pool.ChannelPoolHandler handler, @Nonnull io.netty.channel.EventLoopGroup eventLoop, @Nonnull java.net.InetSocketAddress address)
Description copied from interface:ChannelPoolFactory
Constructs a new ChannelPool which must connect to the specifiedaddress
.- Specified by:
construct
in interfaceChannelPoolFactory
- Parameters:
manager
- The channel pool manager which will manage the pool.handler
- A handler to be notified of events.eventLoop
- The eventloop for the connection pool.address
- Target address/port for the connection pool.- Returns:
- New instance of
ManagedChannelPool
-
construct
@Nonnull protected ManagedChannelPool construct(@Nonnull io.netty.bootstrap.Bootstrap bootstrap, @Nonnull io.netty.channel.pool.ChannelPoolHandler channelPoolHandler, @Nonnull io.netty.channel.pool.ChannelHealthChecker healthChecker, @Nonnull io.netty.channel.pool.FixedChannelPool.AcquireTimeoutAction acquireTimeoutAction, @Nonnull java.util.function.IntSupplier minConnections, int maxConnections, boolean releaseHeathCheck)
-
setHealthCheckIntervalMillis
public void setHealthCheckIntervalMillis(@Nonnegative long healthCheckIntervalMillis)
-
setHealthCheckIntervalMillis
public void setHealthCheckIntervalMillis(@Nonnull java.util.function.LongSupplier healthCheckIntervalMillis)
-
getHealthCheckIntervalMillis
public long getHealthCheckIntervalMillis()
-
isHealthy
public io.netty.util.concurrent.Future<java.lang.Boolean> isHealthy(io.netty.channel.Channel channel)
- Specified by:
isHealthy
in interfaceio.netty.channel.pool.ChannelHealthChecker
-
-