public static final class ConnectionProvider.Builder extends ConnectionProvider.ConnectionPoolSpec<ConnectionProvider.Builder>
ConnectionProvider to 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 |
|---|---|
ConnectionProvider |
build()
Builds new ConnectionProvider
|
ConnectionProvider.Builder |
disposeInactivePoolsInBackground(java.time.Duration disposeInterval,
java.time.Duration poolInactivity)
Set the options to use for configuring
ConnectionProvider background disposal for inactive connection pools. |
ConnectionProvider.Builder |
forRemoteHost(SocketAddress remoteHost,
java.util.function.Consumer<ConnectionProvider.HostSpecificSpec> spec)
Connection pool configuration for a specific remote host.
|
ConnectionProvider.Builder |
name(String name)
ConnectionProvider name is used for metrics |
evictInBackground, fifo, get, lifo, maxConnections, maxIdleTime, maxLifeTime, metrics, metrics, pendingAcquireMaxCount, pendingAcquireTimeoutpublic final ConnectionProvider.Builder name(String name)
ConnectionProvider name is used for metricsname - ConnectionProvider nameNullPointerException - if name is nullpublic final ConnectionProvider.Builder disposeInactivePoolsInBackground(java.time.Duration disposeInterval, java.time.Duration poolInactivity)
ConnectionProvider background 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 disposeInterval of zero means 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 forRemoteHost(SocketAddress remoteHost, java.util.function.Consumer<ConnectionProvider.HostSpecificSpec> spec)
remoteHost - the remote hostspec - connection pool configuration for a this remote hostNullPointerException - if remoteHost or/and spec are nullpublic ConnectionProvider build()