public static class ConnectionProvider.ConnectionPoolSpec<SPEC extends ConnectionProvider.ConnectionPoolSpec<SPEC>> extends Object implements java.util.function.Supplier<SPEC>
Modifier and Type | Method and Description |
---|---|
SPEC |
fifo()
Build a FIFO flavor of
Pool , that is to say a flavor where the first
Pool.acquire() Mono that was pending is served first
whenever a resource becomes available. |
SPEC |
get() |
SPEC |
lifo()
Build a LIFO flavor of
Pool , that is to say a flavor where the last
Pool.acquire() Mono that was pending is served first
whenever a resource becomes available. |
SPEC |
maxConnections(int maxConnections)
Set the options to use for configuring
ConnectionProvider maximum connections per connection pool. |
SPEC |
maxIdleTime(java.time.Duration maxIdleTime)
Set the options to use for configuring
ConnectionProvider max idle time (resolution: ms). |
SPEC |
maxLifeTime(java.time.Duration maxLifeTime)
Set the options to use for configuring
ConnectionProvider max life time (resolution: ms). |
SPEC |
metrics(boolean metricsEnabled)
Whether to enable metrics to be collected and registered in Micrometer's
globalRegistry
under the name Metrics.CONNECTION_PROVIDER_PREFIX . |
SPEC |
pendingAcquireMaxCount(int pendingAcquireMaxCount)
Set the options to use for configuring
ConnectionProvider the maximum number of registered
requests for acquire to keep in a pending queue
When invoked with -1 the pending queue will not have upper limit. |
SPEC |
pendingAcquireTimeout(java.time.Duration pendingAcquireTimeout)
Set the options to use for configuring
ConnectionProvider acquire timeout (resolution: ms). |
public final SPEC pendingAcquireTimeout(java.time.Duration pendingAcquireTimeout)
ConnectionProvider
acquire timeout (resolution: ms).
Default to ConnectionProvider.DEFAULT_POOL_ACQUIRE_TIMEOUT
.pendingAcquireTimeout
- the maximum time after which a pending acquire
must complete or the TimeoutException
will be thrown (resolution: ms)NullPointerException
- if pendingAcquireTimeout is nullpublic final SPEC maxConnections(int maxConnections)
ConnectionProvider
maximum connections per connection pool.
Default to ConnectionProvider.DEFAULT_POOL_MAX_CONNECTIONS
.maxConnections
- the maximum number of connections (per connection pool) before start pendingIllegalArgumentException
- if maxConnections is negativepublic final SPEC pendingAcquireMaxCount(int pendingAcquireMaxCount)
ConnectionProvider
the maximum number of registered
requests for acquire to keep in a pending queue
When invoked with -1 the pending queue will not have upper limit.
Default to 2 * max connections
.pendingAcquireMaxCount
- the maximum number of registered requests for acquire to keep
in a pending queueIllegalArgumentException
- if pendingAcquireMaxCount is negativepublic final SPEC maxIdleTime(java.time.Duration maxIdleTime)
ConnectionProvider
max idle time (resolution: ms).
Default to ConnectionProvider.DEFAULT_POOL_MAX_IDLE_TIME
if specified otherwise - no max idle time.maxIdleTime
- the Duration
after which the channel will be closed when idle (resolution: ms)public final SPEC maxLifeTime(java.time.Duration maxLifeTime)
ConnectionProvider
max life time (resolution: ms).
By default no max life time.maxLifeTime
- the Duration
after which the channel will be closed (resolution: ms)public final SPEC metrics(boolean metricsEnabled)
globalRegistry
under the name Metrics.CONNECTION_PROVIDER_PREFIX
. Applications can
separately register their own
filters
associated with this name.
For example, to put an upper bound on the number of tags produced:
MeterFilter filter = ... ; Metrics.globalRegistry.config().meterFilter(MeterFilter.maximumAllowableTags(CONNECTION_PROVIDER_PREFIX, 100, filter));
By default this is not enabled.
metricsEnabled
- true enables metrics collection; false disables itpublic final SPEC lifo()
Pool
, that is to say a flavor where the last
Pool.acquire()
Mono
that was pending is served first
whenever a resource becomes available.Pool
with LIFO pending acquire orderingpublic final SPEC fifo()
Pool
, that is to say a flavor where the first
Pool.acquire()
Mono
that was pending is served first
whenever a resource becomes available.Pool
with FIFO pending acquire orderingpublic SPEC get()
get
in interface java.util.function.Supplier<SPEC extends ConnectionProvider.ConnectionPoolSpec<SPEC>>