public final class ExternalSqlClientPool extends SqlClientPool
Pool
.
This is an alternative to
DefaultSqlClientPool
,
for use when one doesn't want Hibernate Reactive to manage the
lifecycle of the underlying Pool
.
This implementation is meant to be used in Quarkus or other runtimes.
N.B. the injected pool instance is required to be threadsafe,
while the default implementation in Vert.x version 3 is not.
So use this only by extensions of the default implementation
which can deliver a different actual underlying Pool
instance for each thread.
All clients of the pool instances retrieved from the injected
Pool
instance are expected to be running on a Vert.x
event loop.
Integration tests in Hibernate Reactive run exclusively on the
Vert.x event loop, however in practice this will need to be
guaranteed by the integrating runtime as well.
Alternatively, a valid integration mode which doesn't require
wrapping the Pool
instance with a ThreadLocal
could be devised by having all of the use of the Hibernate
Reactive's SessionFactory instance (Stage.SessionFactory
or a Mutiny.SessionFactory
) constrained within a single
thread, running within the Vert.x event loop.
Constructor and Description |
---|
ExternalSqlClientPool(io.vertx.sqlclient.Pool pool,
org.hibernate.engine.jdbc.spi.SqlStatementLogger sqlStatementLogger) |
ExternalSqlClientPool(io.vertx.sqlclient.Pool pool,
org.hibernate.engine.jdbc.spi.SqlStatementLogger sqlStatementLogger,
boolean usePostgresStyleParameters)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletionStage<java.lang.Void> |
getCloseFuture()
Since this Service implementation does not implement @
Stoppable
and we're only adapting an externally provided pool, we will not actually close such provided pool
when Hibernate ORM is shutdown (it doesn't own the lifecycle of this external component). |
protected io.vertx.sqlclient.Pool |
getPool() |
protected org.hibernate.engine.jdbc.spi.SqlStatementLogger |
getSqlStatementLogger() |
getConnection, getConnection, getProxyConnection, getProxyConnection, getTenantPool
public ExternalSqlClientPool(io.vertx.sqlclient.Pool pool, org.hibernate.engine.jdbc.spi.SqlStatementLogger sqlStatementLogger)
@Deprecated public ExternalSqlClientPool(io.vertx.sqlclient.Pool pool, org.hibernate.engine.jdbc.spi.SqlStatementLogger sqlStatementLogger, boolean usePostgresStyleParameters)
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 executedpublic java.util.concurrent.CompletionStage<java.lang.Void> getCloseFuture()
Stoppable
and we're only adapting an externally provided pool, we will not actually close such provided pool
when Hibernate ORM is shutdown (it doesn't own the lifecycle of this external component).
Therefore there is no need to wait for its shutdown and this method returns an already
successfully completed CompletionStage.