public class ConnectionPool extends Object implements io.r2dbc.spi.ConnectionFactory, Disposable, Closeable, io.r2dbc.spi.Wrapped<io.r2dbc.spi.ConnectionFactory>
Disposable.Composite, Disposable.Swap
Constructor and Description |
---|
ConnectionPool(ConnectionPoolConfiguration configuration)
Creates a new connection factory.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
Mono<io.r2dbc.spi.Connection> |
create() |
void |
dispose() |
Mono<Void> |
disposeLater()
Dispose this
ConnectionPool in non-blocking flow. |
io.r2dbc.spi.ConnectionFactoryMetadata |
getMetadata() |
Optional<PoolMetrics> |
getMetrics()
Returns
PoolMetrics if available. |
protected ObjectName |
getPoolObjectName(String name)
Construct JMX
ObjectName . |
boolean |
isDisposed() |
String |
toString() |
io.r2dbc.spi.ConnectionFactory |
unwrap() |
Mono<Integer> |
warmup()
Warms up the
ConnectionPool , if needed. |
public ConnectionPool(ConnectionPoolConfiguration configuration)
configuration
- the configuration to use for building the connection pool.IllegalArgumentException
- if configuration
is null
public Mono<Integer> warmup()
ConnectionPool
, if needed. This instructs the pool to check for a minimum size and allocate
necessary connections when the minimum is not reached.Mono
that triggers resource warmup and emits the number of warmed up resources.public Mono<io.r2dbc.spi.Connection> create()
create
in interface io.r2dbc.spi.ConnectionFactory
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void dispose()
dispose
in interface Disposable
public Mono<Void> disposeLater()
ConnectionPool
in non-blocking flow.
When multiple errors occurred during dispose flow, they are added as suppressed errors onto the first error.
public boolean isDisposed()
isDisposed
in interface Disposable
public io.r2dbc.spi.ConnectionFactoryMetadata getMetadata()
getMetadata
in interface io.r2dbc.spi.ConnectionFactory
public io.r2dbc.spi.ConnectionFactory unwrap()
unwrap
in interface io.r2dbc.spi.Wrapped<io.r2dbc.spi.ConnectionFactory>
public Optional<PoolMetrics> getMetrics()
PoolMetrics
if available.protected ObjectName getPoolObjectName(String name) throws MalformedObjectNameException
ObjectName
.name
- connection pool nameObjectName
MalformedObjectNameException
- when invalid objectname is constructedCopyright © 2020. All rights reserved.