Package io.agroal.api.configuration
Interface AgroalConnectionPoolConfiguration
public interface AgroalConnectionPoolConfiguration
The configuration of the connection pool.
- Author:
- Luis Barreiro
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInterface for custom connection validation strategies.static interfaceInterface for custom exception sorter strategies.static enumAction to perform on acquisition of multiple connections by the same thread.static enumModes available for transaction requirement. -
Method Summary
Modifier and TypeMethodDescriptionThe maximum amount of time a thread may be blocked waiting for a connection.Customizable strategy for connection caching.Configuration for the connection factory.The connection validation method.booleanProvides detailed insights of the connection status when it's reported as a leak (as INFO messages on AgroalDataSourceListener).Allows a custom exception sorter.booleanIf connections should be flushed when returning to the pool.Connections idle for longer than this time period are validated before being acquired (foreground validation).intThe number of connections to be created when the pool starts.Connections acquired for longer than this time period may be reported as leaking.Connections that are older than this time period are flushed from the pool.intmaxSize()The maximum number of connections on the pool.intminSize()The minimum number of connections on the pool.Behaviour when a thread tries to acquire multiple connections.Connections idle for longer than this time period are flushed from the pool.voidsetAcquisitionTimeout(Duration timeout) Sets a new amount of time a thread may be blocked.voidsetMaxSize(int size) Sets a new maximum number of connections on the pool.voidsetMinSize(int size) Sets a new minimum number of connections on the pool.The transaction layer integration to use.Requires connections to be enlisted into a transaction.Connections idle for longer than this time period are validated (background validation).
-
Method Details
-
connectionFactoryConfiguration
AgroalConnectionFactoryConfiguration connectionFactoryConfiguration()Configuration for the connection factory. -
connectionValidator
AgroalConnectionPoolConfiguration.ConnectionValidator connectionValidator()The connection validation method. Allows customization of the validation operation. -
exceptionSorter
AgroalConnectionPoolConfiguration.ExceptionSorter exceptionSorter()Allows a custom exception sorter. This determines if a connection is still usable after an exception. -
connectionCache
ConnectionCache connectionCache()Customizable strategy for connection caching. -
transactionIntegration
TransactionIntegration transactionIntegration()The transaction layer integration to use. -
transactionRequirement
AgroalConnectionPoolConfiguration.TransactionRequirement transactionRequirement()Requires connections to be enlisted into a transaction. -
idleValidationTimeout
Duration idleValidationTimeout()Connections idle for longer than this time period are validated before being acquired (foreground validation). A duration ofDuration.ZEROmeans that a this feature is disabled. -
leakTimeout
Duration leakTimeout()Connections acquired for longer than this time period may be reported as leaking. A duration ofDuration.ZEROmeans that a this feature is disabled. -
validationTimeout
Duration validationTimeout()Connections idle for longer than this time period are validated (background validation). A duration ofDuration.ZEROmeans that a this feature is disabled. -
reapTimeout
Duration reapTimeout()Connections idle for longer than this time period are flushed from the pool. A duration ofDuration.ZEROmeans that a this feature is disabled. -
maxLifetime
Duration maxLifetime()Connections that are older than this time period are flushed from the pool. A duration ofDuration.ZEROmeans that a this feature is disabled. -
enhancedLeakReport
boolean enhancedLeakReport()Provides detailed insights of the connection status when it's reported as a leak (as INFO messages on AgroalDataSourceListener). -
flushOnClose
boolean flushOnClose()If connections should be flushed when returning to the pool. -
multipleAcquisition
AgroalConnectionPoolConfiguration.MultipleAcquisitionAction multipleAcquisition()Behaviour when a thread tries to acquire multiple connections. -
initialSize
int initialSize()The number of connections to be created when the pool starts. Can be smaller than min or bigger than max. -
minSize
int minSize()The minimum number of connections on the pool. If the pool has to flush connections it may create connections to keep this amount. -
setMinSize
void setMinSize(int size) Sets a new minimum number of connections on the pool. When this value increase the pool may temporarily have less connections than the minimum. -
maxSize
int maxSize()The maximum number of connections on the pool. When the number of acquired connections is equal to this value, further requests will block. -
setMaxSize
void setMaxSize(int size) Sets a new maximum number of connections on the pool. When this value decreases the pool may temporarily have more connections than the maximum. -
acquisitionTimeout
Duration acquisitionTimeout()The maximum amount of time a thread may be blocked waiting for a connection. If this time expires and still no connection is available, an exception is thrown. A duration ofDuration.ZEROmeans that a thread will wait indefinitely. In Pool-less this timeout can add toAgroalConnectionFactoryConfiguration.loginTimeout(). -
setAcquisitionTimeout
Sets a new amount of time a thread may be blocked. Threads already blocked when this value changes do not see the new value when they unblock. A duration ofDuration.ZEROmeans that a thread will wait indefinitely.
-