Package com.linkedin.alpini.netty4.pool
Class SimpleChannelPoolManagerImpl
- java.lang.Object
-
- com.linkedin.alpini.netty4.pool.SimpleChannelPoolManagerImpl
-
- All Implemented Interfaces:
ChannelPoolManager
public class SimpleChannelPoolManagerImpl extends java.lang.Object implements ChannelPoolManager
In order to simplify the implementation of thisChannelPoolManager, this implementation requires thatopen(String)is called to create the hostNameAndPort instead of lazily creating them upon first reference. In the case for Espresso Router, it is informed of all the valid hostNameAndPort from Helix and should then callopen(String)for each host. Calling it for a host that is already existant is a no-operation.
-
-
Field Summary
-
Fields inherited from interface com.linkedin.alpini.netty4.pool.ChannelPoolManager
FAILED_HEALTH_CHECK
-
-
Constructor Summary
Constructors Constructor Description SimpleChannelPoolManagerImpl(E eventLoopGroup, ChannelPoolFactory channelPoolFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description io.netty.util.concurrent.Future<io.netty.channel.Channel>acquire(io.netty.channel.EventLoop eventLoop, java.lang.String hostNameAndPort, java.lang.String queueName, QOS qos)Acquire a channel from the pool.io.netty.util.concurrent.Future<io.netty.channel.Channel>acquire(java.lang.String hostNameAndPort, java.lang.String queueName, QOS qos)Acquire a channel from the pool.io.netty.util.concurrent.Future<java.lang.Void>close(java.lang.String hostNameAndPort)Close the connection pool to the specified host and port.protected ManagedChannelPoolconstructManagedPool(io.netty.channel.pool.ChannelPoolHandler poolHandler, java.net.InetSocketAddress address)protected CallTrackercreateHostAcquireCallTracker(java.lang.String hostAndPort)protected CallTrackercreateHostBusyCallTracker(java.lang.String hostAndPort)intexecutorCount()Deprecated.io.netty.util.concurrent.Future<java.lang.Void>open(java.lang.String hostNameAndPort)Open the connection pool to the specified host and port.io.netty.util.concurrent.Future<java.lang.Void>release(io.netty.channel.Channel channel)Release the channel to the pool.intsubpoolCount()The number of subpool threads used per pool by this class.
-
-
-
Constructor Detail
-
SimpleChannelPoolManagerImpl
public SimpleChannelPoolManagerImpl(@Nonnull E eventLoopGroup, @Nonnull ChannelPoolFactory channelPoolFactory)
-
-
Method Detail
-
constructManagedPool
protected ManagedChannelPool constructManagedPool(io.netty.channel.pool.ChannelPoolHandler poolHandler, java.net.InetSocketAddress address)
-
createHostAcquireCallTracker
@Nonnull protected CallTracker createHostAcquireCallTracker(@Nonnull java.lang.String hostAndPort)
-
createHostBusyCallTracker
@Nonnull protected CallTracker createHostBusyCallTracker(@Nonnull java.lang.String hostAndPort)
-
executorCount
@Deprecated public int executorCount()
Deprecated.Description copied from interface:ChannelPoolManagerThe number of threads in the eventloopgroup used by this class.- Specified by:
executorCountin interfaceChannelPoolManager- Returns:
- thread count
-
subpoolCount
public int subpoolCount()
Description copied from interface:ChannelPoolManagerThe number of subpool threads used per pool by this class. Must be less than or equal to the number of threads in the eventloopgroup. Must be greater than zero.- Specified by:
subpoolCountin interfaceChannelPoolManager- Returns:
- thread count
-
acquire
@Nonnull public io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire(@Nonnull java.lang.String hostNameAndPort, @Nonnull java.lang.String queueName, @Nonnull QOS qos)Description copied from interface:ChannelPoolManagerAcquire a channel from the pool.- Specified by:
acquirein interfaceChannelPoolManager- Parameters:
hostNameAndPort- host name and portqueueName- queue nameqos- priority- Returns:
- future for acquired channel
-
acquire
@Nonnull public io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire(@Nonnull io.netty.channel.EventLoop eventLoop, @Nonnull java.lang.String hostNameAndPort, @Nonnull java.lang.String queueName, @Nonnull QOS qos)Description copied from interface:ChannelPoolManagerAcquire a channel from the pool.- Specified by:
acquirein interfaceChannelPoolManagerhostNameAndPort- host name and portqueueName- queue nameqos- priority- Returns:
- future for acquired channel
-
release
@Nonnull public io.netty.util.concurrent.Future<java.lang.Void> release(@Nonnull io.netty.channel.Channel channel)Description copied from interface:ChannelPoolManagerRelease the channel to the pool.- Specified by:
releasein interfaceChannelPoolManager- Parameters:
channel- channel- Returns:
- future which is completed when done
-
open
public io.netty.util.concurrent.Future<java.lang.Void> open(@Nonnull java.lang.String hostNameAndPort)Description copied from interface:ChannelPoolManagerOpen the connection pool to the specified host and port. The default implementation simply acquires a channel from the pool and then immediately releases it.- Specified by:
openin interfaceChannelPoolManager- Parameters:
hostNameAndPort- Host and port string- Returns:
- future which is completed when done
-
close
@Nonnull public io.netty.util.concurrent.Future<java.lang.Void> close(@Nonnull java.lang.String hostNameAndPort)Description copied from interface:ChannelPoolManagerClose the connection pool to the specified host and port.- Specified by:
closein interfaceChannelPoolManager- Parameters:
hostNameAndPort- Host and port string- Returns:
- future which is completed when done
-
-