public static final class ConnectionProvider.Builder extends ConnectionProvider.ConnectionPoolSpec<ConnectionProvider.Builder>
ConnectionProviderto cache and reuse a fixed maximum number of
Connection. Further connections will be pending acquisition depending on pendingAcquireTime. The maximum number of connections is for the connections in a single connection pool, where a connection pool corresponds to a concrete remote host. The configuration can be either global for all connection pools or be tuned for each individual connection pool, per remote host.
|Modifier and Type||Method and Description|
Builds new ConnectionProvider
Set the options to use for configuring
Connection pool configuration for a specific remote host.
evictInBackground, fifo, get, lifo, maxConnections, maxIdleTime, maxLifeTime, metrics, metrics, pendingAcquireMaxCount, pendingAcquireTimeout
public final ConnectionProvider.Builder name(String name)
ConnectionProvidername is used for metrics
public final ConnectionProvider.Builder disposeInactivePoolsInBackground(java.time.Duration disposeInterval, java.time.Duration poolInactivity)
ConnectionProviderbackground disposal for inactive connection pools. When this option is enabled, the connection pools are regularly checked whether they are empty and inactive for a specified time, thus applicable for disposal. Default to
DISPOSE_INACTIVE_POOLS_IN_BACKGROUND_DISABLED- the background disposal is disabled. Providing a
zeromeans the background disposal is disabled.
disposeInterval- specifies the interval to be used for checking the connection pool inactivity, (resolution: ms)
poolInactivity- specifies the duration after which an empty pool with no recorded interactions is considered inactive (resolution: seconds)
public final ConnectionProvider.Builder disposeTimeout(java.time.Duration timeout)
ConnectionProvider.disposeLater()is called, trigger a
graceful shutdownfor the connection pools, with this grace period timeout. From there on, all calls for acquiring a connection will fail fast with an exception. However, for the provided
Duration, pending acquires will get a chance to be served.
Note: The rejection of new acquires and the grace timer start immediately,
irrespective of subscription to the
Mono returned by
Subsequent calls return the same
Mono, effectively getting notifications from the first graceful
shutdown call and ignoring subsequently provided timeouts.
timeout- the maximum
Durationfor graceful shutdown before full shutdown is forced (resolution: ms)
public final ConnectionProvider.Builder forRemoteHost(SocketAddress remoteHost, java.util.function.Consumer<ConnectionProvider.HostSpecificSpec> spec)
remoteHost- the remote host
spec- connection pool configuration for a this remote host
NullPointerException- if remoteHost or/and spec are null
public ConnectionProvider build()