Package com.linkedin.alpini.netty4.pool
Class ChannelPoolManagerImpl
- java.lang.Object
-
- com.linkedin.alpini.netty4.pool.ChannelPoolManagerImpl
-
- All Implemented Interfaces:
ChannelPoolManager
public class ChannelPoolManagerImpl extends java.lang.Object implements ChannelPoolManager
An implementation of aChannelPoolManager
.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_DB_QUEUE
-
Fields inherited from interface com.linkedin.alpini.netty4.pool.ChannelPoolManager
FAILED_HEALTH_CHECK
-
-
Constructor Summary
Constructors Constructor Description ChannelPoolManagerImpl(E eventLoopGroup, ChannelPoolFactory channelPoolFactory, ChannelPoolResolver channelPoolResolver, int maxWaitersPerPool)
ChannelPoolManagerImpl(E eventLoopGroup, ChannelPoolFactory channelPoolFactory, ChannelPoolResolver channelPoolResolver, int maxWaitersPerPool, boolean useH2GlobalPool, boolean createConnectionsOnWorkerGroup, boolean enableSimpleAcquire)
ChannelPoolManagerImpl(E eventLoopGroup, ChannelPoolFactory channelPoolFactory, ChannelPoolResolver channelPoolResolver, int maxWaitersPerPool, boolean useH2GlobalPool, boolean createConnectionsOnWorkerGroup, boolean enableSimpleAcquire, int pingIntervalSeconds)
-
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 hostName, 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 hostName, java.lang.String queueName, QOS qos)
Acquire a channel from the pool.io.netty.util.concurrent.Future<java.lang.Void>
close(java.lang.String hostName)
Close the connection pool to the specified host and port.protected CallTracker
createHostAcquireCallTracker()
protected CallTracker
createHostBusyCallTracker()
protected CallTracker
createQueueAcquireCallTracker()
Deprecated.protected CallTracker
createQueueBusyCallTracker()
Deprecated.protected java.net.InetSocketAddress
createUnresolved(java.lang.String hostAndPort)
protected java.net.InetSocketAddress
createUnresolved(java.net.InetSocketAddress inetSocketAddress)
boolean
enablePeriodicPing()
int
executorCount()
Deprecated.java.util.Collection<com.linkedin.alpini.netty4.pool.ChannelPoolManagerImpl.Pool>
getPools()
protected io.netty.util.concurrent.Future<io.netty.channel.EventLoopGroup>
localThreadGroup()
protected io.netty.util.concurrent.Future<io.netty.channel.EventLoopGroup>
localThreadGroup(io.netty.channel.EventLoop eventLoop)
io.netty.util.concurrent.Future<java.lang.Void>
release(io.netty.channel.Channel channel)
Release the channel to the pool.void
sendPing()
void
startPeriodicPing()
void
stopPeriodicPing()
int
subpoolCount()
The number of subpool threads used per pool by this class.-
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.ChannelPoolManager
open
-
-
-
-
Field Detail
-
DEFAULT_DB_QUEUE
public static final java.lang.String DEFAULT_DB_QUEUE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChannelPoolManagerImpl
public ChannelPoolManagerImpl(@Nonnull E eventLoopGroup, @Nonnull ChannelPoolFactory channelPoolFactory, @Nonnull ChannelPoolResolver channelPoolResolver, @Nonnegative int maxWaitersPerPool)
-
ChannelPoolManagerImpl
public ChannelPoolManagerImpl(@Nonnull E eventLoopGroup, @Nonnull ChannelPoolFactory channelPoolFactory, @Nonnull ChannelPoolResolver channelPoolResolver, @Nonnegative int maxWaitersPerPool, boolean useH2GlobalPool, boolean createConnectionsOnWorkerGroup, boolean enableSimpleAcquire)
-
ChannelPoolManagerImpl
public ChannelPoolManagerImpl(@Nonnull E eventLoopGroup, @Nonnull ChannelPoolFactory channelPoolFactory, @Nonnull ChannelPoolResolver channelPoolResolver, @Nonnegative int maxWaitersPerPool, boolean useH2GlobalPool, boolean createConnectionsOnWorkerGroup, boolean enableSimpleAcquire, int pingIntervalSeconds)
-
-
Method Detail
-
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
-
startPeriodicPing
public void startPeriodicPing()
-
sendPing
public void sendPing()
-
enablePeriodicPing
public boolean enablePeriodicPing()
-
getPools
public java.util.Collection<com.linkedin.alpini.netty4.pool.ChannelPoolManagerImpl.Pool> getPools()
-
stopPeriodicPing
public void stopPeriodicPing()
-
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
-
createHostAcquireCallTracker
@Nonnull protected CallTracker createHostAcquireCallTracker()
-
createHostBusyCallTracker
@Nonnull protected CallTracker createHostBusyCallTracker()
-
createQueueAcquireCallTracker
@Nonnull @Deprecated protected CallTracker createQueueAcquireCallTracker()
Deprecated.
-
createQueueBusyCallTracker
@Nonnull @Deprecated protected CallTracker createQueueBusyCallTracker()
Deprecated.
-
createUnresolved
@Nonnull protected java.net.InetSocketAddress createUnresolved(@Nonnull java.lang.String hostAndPort)
-
createUnresolved
@Nonnull protected java.net.InetSocketAddress createUnresolved(@Nonnull java.net.InetSocketAddress inetSocketAddress)
-
close
@Nonnull public io.netty.util.concurrent.Future<java.lang.Void> close(@Nonnull java.lang.String hostName)
Description copied from interface:ChannelPoolManager
Close the connection pool to the specified host and port.- Specified by:
close
in interfaceChannelPoolManager
- Parameters:
hostName
- Host and port string- Returns:
- future which is completed when done
-
localThreadGroup
protected io.netty.util.concurrent.Future<io.netty.channel.EventLoopGroup> localThreadGroup()
-
localThreadGroup
protected io.netty.util.concurrent.Future<io.netty.channel.EventLoopGroup> localThreadGroup(@Nonnull io.netty.channel.EventLoop eventLoop)
-
acquire
@Nonnull public io.netty.util.concurrent.Future<io.netty.channel.Channel> acquire(@Nonnull java.lang.String hostName, @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:
hostName
- 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 hostName, @Nonnull java.lang.String queueName, @Nonnull QOS qos)
Description copied from interface:ChannelPoolManager
Acquire a channel from the pool.- Specified by:
acquire
in interfaceChannelPoolManager
hostName
- 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
-
-