Package io.agroal.pool
Class Poolless
- java.lang.Object
-
- io.agroal.pool.Poolless
-
- All Implemented Interfaces:
AgroalDataSourceConfiguration.MetricsEnabledListener,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 Summary
Constructors Constructor Description Poolless(AgroalConnectionPoolConfiguration configuration, AgroalDataSourceListener... listeners)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longactiveCount()longavailableCount()longawaitingCount()voidclose()intdefaultJdbcIsolationLevel()voidflushPool(AgroalDataSource.FlushMode mode)AgroalConnectionPoolConfigurationgetConfiguration()ConnectiongetConnection()AgroalDataSourceListener[]getListeners()MetricsRepositorygetMetrics()List<AgroalPoolInterceptor>getPoolInterceptors()voidinit()booleanisHealthy(boolean newConnection)longmaxUsedCount()voidonMetricsEnabled(boolean metricsEnabled)voidresetMaxUsedCount()voidreturnConnectionHandler(ConnectionHandler handler)voidsetPoolInterceptors(Collection<? extends AgroalPoolInterceptor> list)
-
-
-
Constructor Detail
-
Poolless
public Poolless(AgroalConnectionPoolConfiguration configuration, AgroalDataSourceListener... listeners)
-
-
Method Detail
-
getConfiguration
public AgroalConnectionPoolConfiguration getConfiguration()
- Specified by:
getConfigurationin interfacePool
-
defaultJdbcIsolationLevel
public int defaultJdbcIsolationLevel()
- Specified by:
defaultJdbcIsolationLevelin interfacePool
-
getListeners
public AgroalDataSourceListener[] getListeners()
- Specified by:
getListenersin interfacePool
-
getPoolInterceptors
public List<AgroalPoolInterceptor> getPoolInterceptors()
- Specified by:
getPoolInterceptorsin interfacePool
-
setPoolInterceptors
public void setPoolInterceptors(Collection<? extends AgroalPoolInterceptor> list)
- Specified by:
setPoolInterceptorsin interfacePool
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacePool
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnectionin interfacePool- Throws:
SQLException
-
returnConnectionHandler
public void returnConnectionHandler(ConnectionHandler handler) throws SQLException
- Specified by:
returnConnectionHandlerin interfacePool- Throws:
SQLException
-
onMetricsEnabled
public void onMetricsEnabled(boolean metricsEnabled)
- Specified by:
onMetricsEnabledin interfaceAgroalDataSourceConfiguration.MetricsEnabledListener
-
getMetrics
public MetricsRepository getMetrics()
- Specified by:
getMetricsin interfacePool
-
activeCount
public long activeCount()
- Specified by:
activeCountin interfacePool
-
availableCount
public long availableCount()
- Specified by:
availableCountin interfacePool
-
maxUsedCount
public long maxUsedCount()
- Specified by:
maxUsedCountin interfacePool
-
resetMaxUsedCount
public void resetMaxUsedCount()
- Specified by:
resetMaxUsedCountin interfacePool
-
awaitingCount
public long awaitingCount()
- Specified by:
awaitingCountin interfacePool
-
isHealthy
public boolean isHealthy(boolean newConnection) throws SQLException- Specified by:
isHealthyin interfacePool- Throws:
SQLException
-
flushPool
public void flushPool(AgroalDataSource.FlushMode mode)
-
-