Class Poolless

java.lang.Object
io.agroal.pool.Poolless
All Implemented Interfaces:
io.agroal.api.configuration.AgroalDataSourceConfiguration.MetricsEnabledListener, io.agroal.api.transaction.TransactionIntegration.ResourceRecoveryFactory, Pool, AutoCloseable

public final class Poolless extends Object implements Pool
Alternative implementation of ConnectionPool for the special case of flush-on-close (and min-size == 0) In particular, this removes the need for the executor. Also, there is no thread-local connection cache as connections are not reused
Author:
Luis Barreiro
  • Constructor Details

    • Poolless

      public Poolless(io.agroal.api.configuration.AgroalConnectionPoolConfiguration configuration, io.agroal.api.AgroalDataSourceListener... listeners)
  • Method Details

    • init

      public void init()
      Specified by:
      init in interface Pool
    • getConfiguration

      public io.agroal.api.configuration.AgroalConnectionPoolConfiguration getConfiguration()
      Specified by:
      getConfiguration in interface Pool
    • defaultJdbcIsolationLevel

      public int defaultJdbcIsolationLevel()
      Specified by:
      defaultJdbcIsolationLevel in interface Pool
    • getListeners

      public io.agroal.api.AgroalDataSourceListener[] getListeners()
      Specified by:
      getListeners in interface Pool
    • getPoolInterceptors

      public List<io.agroal.api.AgroalPoolInterceptor> getPoolInterceptors()
      Specified by:
      getPoolInterceptors in interface Pool
    • setPoolInterceptors

      public void setPoolInterceptors(Collection<? extends io.agroal.api.AgroalPoolInterceptor> list)
      Specified by:
      setPoolInterceptors in interface Pool
    • isRecoverable

      public boolean isRecoverable()
      Specified by:
      isRecoverable in interface io.agroal.api.transaction.TransactionIntegration.ResourceRecoveryFactory
    • getRecoveryConnection

      public XAConnection getRecoveryConnection() throws SQLException
      Specified by:
      getRecoveryConnection in interface io.agroal.api.transaction.TransactionIntegration.ResourceRecoveryFactory
      Throws:
      SQLException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Pool
    • getConnection

      public Connection getConnection() throws SQLException
      Specified by:
      getConnection in interface Pool
      Throws:
      SQLException
    • getReadOnlyConnection

      public Connection getReadOnlyConnection() throws SQLException
      Specified by:
      getReadOnlyConnection in interface Pool
      Throws:
      SQLException
    • returnConnectionHandler

      public void returnConnectionHandler(ConnectionHandler handler) throws SQLException
      Specified by:
      returnConnectionHandler in interface Pool
      Throws:
      SQLException
    • onMetricsEnabled

      public void onMetricsEnabled(boolean metricsEnabled)
      Specified by:
      onMetricsEnabled in interface io.agroal.api.configuration.AgroalDataSourceConfiguration.MetricsEnabledListener
    • getMetrics

      public MetricsRepository getMetrics()
      Specified by:
      getMetrics in interface Pool
    • activeCount

      public long activeCount()
      Specified by:
      activeCount in interface Pool
    • availableCount

      public long availableCount()
      Specified by:
      availableCount in interface Pool
    • maxUsedCount

      public long maxUsedCount()
      Specified by:
      maxUsedCount in interface Pool
    • resetMaxUsedCount

      public void resetMaxUsedCount()
      Specified by:
      resetMaxUsedCount in interface Pool
    • awaitingCount

      public long awaitingCount()
      Specified by:
      awaitingCount in interface Pool
    • isHealthy

      public boolean isHealthy(boolean newConnection) throws SQLException
      Specified by:
      isHealthy in interface Pool
      Throws:
      SQLException
    • flushPool

      public void flushPool(io.agroal.api.AgroalDataSource.FlushMode mode)
      Specified by:
      flushPool in interface Pool