T
- the poolable resourcepublic abstract class PooledConnectionProvider<T extends Connection> extends Object implements ConnectionProvider
ConnectionProvider
implementation.Modifier and Type | Class and Description |
---|---|
protected static class |
PooledConnectionProvider.PoolFactory<T extends Connection> |
ConnectionProvider.Builder, ConnectionProvider.ConnectionPoolSpec<SPEC extends ConnectionProvider.ConnectionPoolSpec<SPEC>>, ConnectionProvider.HostSpecificSpec, ConnectionProvider.MeterRegistrar
Disposable.Composite, Disposable.Swap
DEFAULT_POOL_ACQUIRE_TIMEOUT, DEFAULT_POOL_LEASING_STRATEGY, DEFAULT_POOL_MAX_CONNECTIONS, DEFAULT_POOL_MAX_IDLE_TIME, DEFAULT_POOL_MAX_LIFE_TIME, LEASING_STRATEGY_FIFO, LEASING_STRATEGY_LIFO
Modifier | Constructor and Description |
---|---|
protected |
PooledConnectionProvider(ConnectionProvider.Builder builder) |
Modifier and Type | Method and Description |
---|---|
Mono<? extends Connection> |
acquire(TransportConfig config,
ConnectionObserver connectionObserver,
java.util.function.Supplier<? extends SocketAddress> remote,
AddressResolverGroup<?> resolverGroup)
Return an existing or new
Connection on subscribe. |
protected abstract CoreSubscriber<reactor.pool.PooledRef<T>> |
createDisposableAcquire(TransportConfig config,
ConnectionObserver connectionObserver,
long pendingAcquireTimeout,
reactor.pool.InstrumentedPool<T> pool,
MonoSink<Connection> sink) |
protected abstract reactor.pool.InstrumentedPool<T> |
createPool(TransportConfig config,
PooledConnectionProvider.PoolFactory<T> poolFactory,
SocketAddress remoteAddress,
AddressResolverGroup<?> resolverGroup) |
Mono<Void> |
disposeLater()
Returns a Mono that triggers the disposal of the ConnectionProvider when subscribed to.
|
void |
disposeWhen(SocketAddress address)
Dispose all connection pools for the specified remote address.
|
boolean |
isDisposed() |
protected static void |
logPoolState(Channel channel,
reactor.pool.InstrumentedPool<? extends Connection> pool,
String msg) |
protected static void |
logPoolState(Channel channel,
reactor.pool.InstrumentedPool<? extends Connection> pool,
String msg,
Throwable t) |
int |
maxConnections()
Returns the maximum number of connections before starting pending
|
protected PooledConnectionProvider.PoolFactory<T> |
poolFactory(SocketAddress remoteAddress) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
builder, create, create, dispose, maxConnectionsPerHost, newConnection
protected PooledConnectionProvider(ConnectionProvider.Builder builder)
public final Mono<? extends Connection> acquire(TransportConfig config, ConnectionObserver connectionObserver, @Nullable java.util.function.Supplier<? extends SocketAddress> remote, @Nullable AddressResolverGroup<?> resolverGroup)
ConnectionProvider
Connection
on subscribe.acquire
in interface ConnectionProvider
config
- the transport configurationconnectionObserver
- the ConnectionObserver
remote
- the SocketAddress
to connect toresolverGroup
- the resolver which will resolve the address of the unresolved named addressMono
of Connection
public final Mono<Void> disposeLater()
ConnectionProvider
This method has NOOP
default implementation.
ConnectionProvider
implementations may decide to provide more specific implementation.
disposeLater
in interface ConnectionProvider
public final void disposeWhen(SocketAddress address)
ConnectionProvider
This method has NOOP
default implementation.
ConnectionProvider
implementations may decide to provide more specific implementation.
disposeWhen
in interface ConnectionProvider
address
- the remote addresspublic final boolean isDisposed()
isDisposed
in interface Disposable
public int maxConnections()
ConnectionProvider
maxConnections
in interface ConnectionProvider
protected abstract CoreSubscriber<reactor.pool.PooledRef<T>> createDisposableAcquire(TransportConfig config, ConnectionObserver connectionObserver, long pendingAcquireTimeout, reactor.pool.InstrumentedPool<T> pool, MonoSink<Connection> sink)
protected abstract reactor.pool.InstrumentedPool<T> createPool(TransportConfig config, PooledConnectionProvider.PoolFactory<T> poolFactory, SocketAddress remoteAddress, AddressResolverGroup<?> resolverGroup)
protected PooledConnectionProvider.PoolFactory<T> poolFactory(SocketAddress remoteAddress)
protected static void logPoolState(Channel channel, reactor.pool.InstrumentedPool<? extends Connection> pool, String msg)
protected static void logPoolState(Channel channel, reactor.pool.InstrumentedPool<? extends Connection> pool, String msg, @Nullable Throwable t)