Interface ReactiveConnectionPool

  • All Superinterfaces:
    java.io.Serializable, org.hibernate.service.Service
    All Known Implementing Classes:
    DefaultSqlClientPool, ExternalSqlClientPool, SqlClientPool

    public interface ReactiveConnectionPool
    extends org.hibernate.service.Service
    A Hibernate Service that provides access to pooled reactive connections.

    A custom implementation of ReactiveConnectionPool may be selected by setting the configuration property Settings.SQL_CLIENT_POOL.

    Alternatively, a program may integrate a custom ReactiveConnectionPool by contributing a new service using a StandardServiceInitiator or from code-based Hibernate configuration by calling StandardServiceRegistryBuilder.addService(java.lang.Class<T>, T).

     new ReactiveServiceRegistryBuilder()
         .applySettings( properties )
         .addService( ReactiveConnectionPool.class, new MyReactiveConnectionPool() )
         .build();
     
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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.
      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.
    • Method Detail

      • getConnection

        java.util.concurrent.CompletionStage<ReactiveConnection> getConnection()
        Obtain a reactive connection, returning the connection via a CompletionStage.
      • getConnection

        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.
      • getConnection

        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.
      • getConnection

        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.
      • getCloseFuture

        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. 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.