类 ConnectionPool
java.lang.Object
org.apache.pulsar.client.impl.ConnectionPool
- 所有已实现的接口:
AutoCloseable
-
字段概要
字段修饰符和类型字段说明protected final io.netty.resolver.AddressResolver<InetSocketAddress>static final intprotected final ConcurrentMap<org.apache.pulsar.client.impl.ConnectionPool.Key,CompletableFuture<ClientCnx>> -
构造器概要
构造器构造器说明ConnectionPool(InstrumentProvider instrumentProvider, ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup) ConnectionPool(InstrumentProvider instrumentProvider, ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup, Supplier<ClientCnx> clientCnxSupplier) ConnectionPool(InstrumentProvider instrumentProvider, ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup, Supplier<ClientCnx> clientCnxSupplier, Optional<io.netty.resolver.AddressResolver<InetSocketAddress>> addressResolver) -
方法概要
修饰符和类型方法说明voidclose()voidintgetConnection(InetSocketAddress address) getConnection(InetSocketAddress logicalAddress, InetSocketAddress physicalAddress, int randomKey) Get a connection from the pool.void
-
字段详细资料
-
IDLE_DETECTION_INTERVAL_SECONDS_MIN
public static final int IDLE_DETECTION_INTERVAL_SECONDS_MIN- 另请参阅:
-
pool
protected final ConcurrentMap<org.apache.pulsar.client.impl.ConnectionPool.Key,CompletableFuture<ClientCnx>> pool -
addressResolver
-
-
构造器详细资料
-
ConnectionPool
public ConnectionPool(InstrumentProvider instrumentProvider, ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup) throws PulsarClientException -
ConnectionPool
public ConnectionPool(InstrumentProvider instrumentProvider, ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup, Supplier<ClientCnx> clientCnxSupplier) throws PulsarClientException -
ConnectionPool
public ConnectionPool(InstrumentProvider instrumentProvider, ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup, Supplier<ClientCnx> clientCnxSupplier, Optional<io.netty.resolver.AddressResolver<InetSocketAddress>> addressResolver) throws PulsarClientException
-
-
方法详细资料
-
genRandomKeyToSelectCon
public int genRandomKeyToSelectCon() -
getConnection
-
getConnection
public CompletableFuture<ClientCnx> getConnection(InetSocketAddress logicalAddress, InetSocketAddress physicalAddress, int randomKey) Get a connection from the pool.The connection can either be created or be coming from the pool itself.
When specifying multiple addresses, the logicalAddress is used as a tag for the broker, while the physicalAddress is where the connection is actually happening.
These two addresses can be different when the client is forced to connect through a proxy layer. Essentially, the pool is using the logical address as a way to decide whether to reuse a particular connection.
- 参数:
logicalAddress- the address to use as the broker tagphysicalAddress- the real address where the TCP connection should be made- 返回:
- a future that will produce the ClientCnx object
-
releaseConnection
-
close
- 指定者:
close在接口中AutoCloseable- 抛出:
Exception
-
doMarkAndReleaseUselessConnections
public void doMarkAndReleaseUselessConnections() -
getConnections
-