Class 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.x Pool 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 of Pool, but rather has a supplier which produces a new Pool within each context.

    See Also:
    the default implementation, the implementation used in Quarkus, Serialized Form
    • 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 a CompletionStage.
      java.util.concurrent.CompletionStage<ReactiveConnection> getConnection​(java.lang.String tenantId)
      Obtain a reactive connection for the given tenant id, returning the connection via a CompletionStage.
      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 a CompletionStage and overriding the default SqlExceptionHelper for the pool.
      java.util.concurrent.CompletionStage<ReactiveConnection> getConnection​(org.hibernate.engine.jdbc.spi.SqlExceptionHelper sqlExceptionHelper)
      Obtain a reactive connection, returning the connection via a CompletionStage and overriding the default SqlExceptionHelper 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 a Pool for the specified tenant.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SqlClientPool

        public SqlClientPool()
    • 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 a Pool 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​(org.hibernate.engine.jdbc.spi.SqlExceptionHelper sqlExceptionHelper)
        Description copied from interface: ReactiveConnectionPool
        Obtain a reactive connection, returning the connection via a CompletionStage and overriding the default SqlExceptionHelper for the pool.
        Specified by:
        getConnection in interface ReactiveConnectionPool
      • 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 a CompletionStage and overriding the default SqlExceptionHelper for the pool.
        Specified by:
        getConnection in interface ReactiveConnectionPool