Package io.agroal.api.configuration
Interface AgroalConnectionPoolConfiguration
-
public interface AgroalConnectionPoolConfiguration
The configuration of the connection pool.- Author:
- Luis Barreiro
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
AgroalConnectionPoolConfiguration.ConnectionValidator
Interface for custom connection validation strategies.static interface
AgroalConnectionPoolConfiguration.ExceptionSorter
Interface for custom exception sorter strategies.static class
AgroalConnectionPoolConfiguration.MultipleAcquisitionAction
Action to perform on acquisition of multiple connections by the same thread.static class
AgroalConnectionPoolConfiguration.TransactionRequirement
Modes available for transaction requirement.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Duration
acquisitionTimeout()
The maximum amount of time a thread may be blocked waiting for a connection.ConnectionCache
connectionCache()
Customizable strategy for connection caching.AgroalConnectionFactoryConfiguration
connectionFactoryConfiguration()
Configuration for the connection factory.AgroalConnectionPoolConfiguration.ConnectionValidator
connectionValidator()
The connection validation method.boolean
enhancedLeakReport()
Provides detailed insights of the connection status when it's reported as a leak (as INFO messages on AgroalDataSourceListener).AgroalConnectionPoolConfiguration.ExceptionSorter
exceptionSorter()
Allows a custom exception sorter.boolean
flushOnClose()
If connections should be flushed when returning to the pool.Duration
idleValidationTimeout()
Connections idle for longer than this time period are validated before being acquired (foreground validation).int
initialSize()
The number of connections to be created when the pool starts.Duration
leakTimeout()
Connections acquired for longer than this time period may be reported as leaking.Duration
maxLifetime()
Connections that are older than this time period are flushed from the pool.int
maxSize()
The maximum number of connections on the pool.int
minSize()
The minimum number of connections on the pool.AgroalConnectionPoolConfiguration.MultipleAcquisitionAction
multipleAcquisition()
Behaviour when a thread tries to acquire multiple connections.Duration
reapTimeout()
Connections idle for longer than this time period are flushed from the pool.void
setAcquisitionTimeout(Duration timeout)
Sets a new amount of time a thread may be blocked.void
setMaxSize(int size)
Sets a new maximum number of connections on the pool.void
setMinSize(int size)
Sets a new minimum number of connections on the pool.TransactionIntegration
transactionIntegration()
The transaction layer integration to use.AgroalConnectionPoolConfiguration.TransactionRequirement
transactionRequirement()
Requires connections to be enlisted into a transaction.Duration
validationTimeout()
Connections idle for longer than this time period are validated (background validation).
-
-
-
Method Detail
-
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.ZERO
means 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.ZERO
means that a this feature is disabled.
-
validationTimeout
Duration validationTimeout()
Connections idle for longer than this time period are validated (background validation). A duration ofDuration.ZERO
means 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.ZERO
means 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.ZERO
means 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.ZERO
means that a thread will wait indefinitely. In Pool-less this timeout can add toAgroalConnectionFactoryConfiguration.loginTimeout()
.
-
setAcquisitionTimeout
void setAcquisitionTimeout(Duration timeout)
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.ZERO
means that a thread will wait indefinitely.
-
-