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
.protected abstract io.vertx.sqlclient.Pool
getPool()
ReactiveConnection
getProxyConnection()
Obtain a lazily-initializing reactive connection.ReactiveConnection
getProxyConnection(java.lang.String tenantId)
Obtain a lazily-initializing reactive connection for the given tenant id.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
-
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:
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(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
-
getProxyConnection
public ReactiveConnection getProxyConnection()
Description copied from interface:ReactiveConnectionPool
Obtain a lazily-initializing reactive connection. The actual connection might be made when the returned instance ifReactiveConnection
is first used.- Specified by:
getProxyConnection
in interfaceReactiveConnectionPool
-
getProxyConnection
public ReactiveConnection getProxyConnection(java.lang.String tenantId)
Description copied from interface:ReactiveConnectionPool
Obtain a lazily-initializing reactive connection for the given tenant id. The actual connection might be made when the returned instance ifReactiveConnection
is first used.- Specified by:
getProxyConnection
in interfaceReactiveConnectionPool
-
-