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 ManagedChannelPool
constructManagedPool(io.netty.channel.pool.ChannelPoolHandler poolHandler, java.net.InetSocketAddress address)
protected CallTracker
createHostAcquireCallTracker(java.lang.String hostAndPort)
protected CallTracker
createHostBusyCallTracker(java.lang.String hostAndPort)
int
executorCount()
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.int
subpoolCount()
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:ChannelPoolManager
The number of threads in the eventloopgroup used by this class.- Specified by:
executorCount
in interfaceChannelPoolManager
- Returns:
- thread count
-
subpoolCount
public int subpoolCount()
Description copied from interface:ChannelPoolManager
The 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:
subpoolCount
in 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:ChannelPoolManager
Acquire a channel from the pool.- Specified by:
acquire
in 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:ChannelPoolManager
Acquire a channel from the pool.- Specified by:
acquire
in interfaceChannelPoolManager
hostNameAndPort
- 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:ChannelPoolManager
Release the channel to the pool.- Specified by:
release
in 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:ChannelPoolManager
Open 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:
open
in 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:ChannelPoolManager
Close the connection pool to the specified host and port.- Specified by:
close
in interfaceChannelPoolManager
- Parameters:
hostNameAndPort
- Host and port string- Returns:
- future which is completed when done
-
-