Package org.hibernate.reactive.pool.impl
Class SqlClientPool
- java.lang.Object
-
- org.hibernate.reactive.pool.impl.SqlClientPool
-
- All Implemented Interfaces:
java.io.Serializable
,ReactiveConnectionPool
,org.hibernate.service.Service
- Direct Known Subclasses:
DefaultSqlClientPool
,ExternalSqlClientPool
public abstract class SqlClientPool extends java.lang.Object implements ReactiveConnectionPool
A pool of reactive connections backed by a supplier of Vert.xPool
instances.The Vert.x notion of pool is not to be confused with the traditional JDBC notion of a connection pool: there is a fundamental difference as the Vert.x pool should not be shared across threads or with other Vert.x contexts.
Therefore, the reactive
SessionFactory
doesn't retain a single instance ofPool
, but rather has a supplier which produces a newPool
within each context.
-
-
Constructor Summary
Constructors Constructor Description SqlClientPool()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletionStage<ReactiveConnection>
getConnection()
Obtain a reactive connection, returning the connection via aCompletionStage
.java.util.concurrent.CompletionStage<ReactiveConnection>
getConnection(java.lang.String tenantId)
Obtain a reactive connection for the given tenant id, returning the connection via aCompletionStage
.java.util.concurrent.CompletionStage<ReactiveConnection>
getConnection(java.lang.String tenantId, org.hibernate.engine.jdbc.spi.SqlExceptionHelper sqlExceptionHelper)
Obtain a reactive connection for the given tenant id, returning the connection via aCompletionStage
and overriding the defaultSqlExceptionHelper
for the pool.java.util.concurrent.CompletionStage<ReactiveConnection>
getConnection(org.hibernate.engine.jdbc.spi.SqlExceptionHelper sqlExceptionHelper)
Obtain a reactive connection, returning the connection via aCompletionStage
and overriding the defaultSqlExceptionHelper
for the pool.protected abstract io.vertx.sqlclient.Pool
getPool()
protected abstract org.hibernate.engine.jdbc.spi.SqlExceptionHelper
getSqlExceptionHelper()
protected abstract org.hibernate.engine.jdbc.spi.SqlStatementLogger
getSqlStatementLogger()
protected io.vertx.sqlclient.Pool
getTenantPool(java.lang.String tenantId)
Get aPool
for the specified tenant.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.reactive.pool.ReactiveConnectionPool
getCloseFuture
-
-
-
-
Method Detail
-
getPool
protected abstract io.vertx.sqlclient.Pool getPool()
- Returns:
- the underlying Vert.x
Pool
for the current context.
-
getSqlStatementLogger
protected abstract org.hibernate.engine.jdbc.spi.SqlStatementLogger getSqlStatementLogger()
- Returns:
- a Hibernate
SqlStatementLogger
for logging SQL statements as they are executed
-
getSqlExceptionHelper
protected abstract org.hibernate.engine.jdbc.spi.SqlExceptionHelper getSqlExceptionHelper()
- Returns:
- a Hibernate
SqlExceptionHelper
for converting exceptions
-
getTenantPool
protected io.vertx.sqlclient.Pool getTenantPool(java.lang.String tenantId)
Get aPool
for the specified tenant.This is an unimplemented operation which must be overridden by subclasses which support multitenancy.
- Parameters:
tenantId
- the id of the tenant- Throws:
java.lang.UnsupportedOperationException
- if multitenancy is not supported- See Also:
ReactiveConnectionPool.getConnection(String)
-
getConnection
public java.util.concurrent.CompletionStage<ReactiveConnection> getConnection()
Description copied from interface:ReactiveConnectionPool
Obtain a reactive connection, returning the connection via aCompletionStage
.- Specified by:
getConnection
in interfaceReactiveConnectionPool
-
getConnection
public java.util.concurrent.CompletionStage<ReactiveConnection> getConnection(org.hibernate.engine.jdbc.spi.SqlExceptionHelper sqlExceptionHelper)
Description copied from interface:ReactiveConnectionPool
Obtain a reactive connection, returning the connection via aCompletionStage
and overriding the defaultSqlExceptionHelper
for the pool.- Specified by:
getConnection
in interfaceReactiveConnectionPool
-
getConnection
public java.util.concurrent.CompletionStage<ReactiveConnection> getConnection(java.lang.String tenantId)
Description copied from interface:ReactiveConnectionPool
Obtain a reactive connection for the given tenant id, returning the connection via aCompletionStage
.- Specified by:
getConnection
in interfaceReactiveConnectionPool
-
getConnection
public java.util.concurrent.CompletionStage<ReactiveConnection> getConnection(java.lang.String tenantId, org.hibernate.engine.jdbc.spi.SqlExceptionHelper sqlExceptionHelper)
Description copied from interface:ReactiveConnectionPool
Obtain a reactive connection for the given tenant id, returning the connection via aCompletionStage
and overriding the defaultSqlExceptionHelper
for the pool.- Specified by:
getConnection
in interfaceReactiveConnectionPool
-
-