public class DefaultSqlClientPool extends SqlClientPool implements org.hibernate.service.spi.ServiceRegistryAwareService, org.hibernate.service.spi.Configurable, org.hibernate.service.spi.Stoppable, org.hibernate.service.spi.Startable
Pool
.
The Pool
itself is backed by an instance of Vertx
obtained via the VertxInstance
service. Configuration of
the Pool
is handled by the SqlClientPoolConfiguration
service.
This class may be extended by programs which wish to implement custom connection management or multitenancy.
The lifecycle of this pool is managed by Hibernate Reactive: it
is created when the reactive SessionFactory
is created and destroyed when the SessionFactory
is
destroyed. For cases where the underlying Pool
lifecycle
is managed externally to Hibernate, use
ExternalSqlClientPool
.
SqlClientPoolConfiguration
,
Serialized FormConstructor and Description |
---|
DefaultSqlClientPool() |
Modifier and Type | Method and Description |
---|---|
void |
configure(java.util.Map configuration) |
protected io.vertx.sqlclient.Pool |
createPool(java.net.URI uri)
Create a new
Pool for the given JDBC URL or database URI,
using the VertxInstance service to obtain an instance of
Vertx , and the SqlClientPoolConfiguration service
to obtain options for creating the connection pool instances. |
protected io.vertx.sqlclient.Pool |
createPool(java.net.URI uri,
io.vertx.sqlclient.SqlConnectOptions connectOptions,
io.vertx.sqlclient.PoolOptions poolOptions,
io.vertx.core.Vertx vertx)
Create a new
Pool for the given JDBC URL or database URI,
connection pool options, and the given instance of Vertx . |
java.util.concurrent.CompletionStage<java.lang.Void> |
getCloseFuture()
The shutdown of the pool is actually asynchronous but the
core service registry won't return the
CompletionStage . |
protected io.vertx.sqlclient.Pool |
getPool() |
protected org.hibernate.engine.jdbc.spi.SqlStatementLogger |
getSqlStatementLogger() |
void |
injectServices(org.hibernate.service.spi.ServiceRegistryImplementor serviceRegistry) |
protected java.net.URI |
jdbcUrl(java.util.Map<?,?> configurationValues)
Determine the JDBC URL or database URI from the given configuration.
|
static java.net.URI |
parse(java.lang.String url) |
void |
start() |
void |
stop() |
getConnection, getConnection, getProxyConnection, getProxyConnection, getTenantPool
public void injectServices(org.hibernate.service.spi.ServiceRegistryImplementor serviceRegistry)
injectServices
in interface org.hibernate.service.spi.ServiceRegistryAwareService
public void configure(java.util.Map configuration)
configure
in interface org.hibernate.service.spi.Configurable
public void start()
start
in interface org.hibernate.service.spi.Startable
public java.util.concurrent.CompletionStage<java.lang.Void> getCloseFuture()
ReactiveConnectionPool
CompletionStage
.
If you need to wait for the underlying pool to be closed,
after closing the SessionFactory you can get the CompletionStage
instance from this getter.getCloseFuture
in interface ReactiveConnectionPool
protected io.vertx.sqlclient.Pool getPool()
getPool
in class SqlClientPool
Pool
for the current context.protected org.hibernate.engine.jdbc.spi.SqlStatementLogger getSqlStatementLogger()
getSqlStatementLogger
in class SqlClientPool
SqlStatementLogger
for logging SQL
statements as they are executedprotected io.vertx.sqlclient.Pool createPool(java.net.URI uri)
Pool
for the given JDBC URL or database URI,
using the VertxInstance
service to obtain an instance of
Vertx
, and the SqlClientPoolConfiguration
service
to obtain options for creating the connection pool instances.uri
- JDBC URL or database URIPool
protected io.vertx.sqlclient.Pool createPool(java.net.URI uri, io.vertx.sqlclient.SqlConnectOptions connectOptions, io.vertx.sqlclient.PoolOptions poolOptions, io.vertx.core.Vertx vertx)
Pool
for the given JDBC URL or database URI,
connection pool options, and the given instance of Vertx
.uri
- JDBC URL or database URIconnectOptions
- the connection optionspoolOptions
- the connection pooling optionsvertx
- the instance of Vertx
to be used by the poolPool
protected java.net.URI jdbcUrl(java.util.Map<?,?> configurationValues)
configurationValues
- the configuration propertiesURI
public void stop()
stop
in interface org.hibernate.service.spi.Stoppable
public static java.net.URI parse(java.lang.String url)