Interface DataSourceJdbcRuntimeConfig
-
Method Summary
Modifier and TypeMethodDescriptionThe timeout before cancelling the acquisition of a new connectionOther unspecified properties to be passed to the JDBC driver when creating new connections.The interval at which we validate idle connections in the background.booleanWhen enabled, Agroal will be able to produce a warning when a connection is returned to the pool without the application having closed all open statements.Enable KeepAlive for this datasource.booleanWhether to enable recovery for this datasource.booleanCollect and display extra troubleshooting info on leaked connections.booleanAllows connections to be flushed upon return to the pool.Perform foreground validation on connections that have been idle for longer than the specified interval.The interval at which we try to remove idle connections.The initial size of the pool.The interval at which we check for connection leaks.Maximum time to wait while attempting to connect to a database.The max lifetime of a connection.intmaxSize()The datasource pool maximum sizeintminSize()The datasource pool minimum sizeio.agroal.api.configuration.AgroalConnectionPoolConfiguration.MultipleAcquisitionActionDefines the behavior when a thread tries to acquire multiple connections from the pool.Sets the maximum duration a connection will wait for the database to reply to any one request, using the standard JDBC 4.1Connection.setNetworkTimeout(java.util.concurrent.Executor, int)API.Query executed when first using a connection.booleanDisable pooling to prevent reuse of Connections.The timeout value used for socket read operations.OpenTelemetry JDBC instrumentation configuration.Optional<io.agroal.api.configuration.AgroalConnectionFactoryConfiguration.TransactionIsolation> The transaction isolation level.Optional<io.agroal.api.configuration.AgroalConnectionPoolConfiguration.TransactionRequirement> Require an active transaction when acquiring a connection.url()The datasource URLbooleanForces connection validation prior to acquisition (foreground validation) regardless of the idle status.Query executed to validate a connection.The timeout for the connection validation query
-
Method Details
-
url
Optional<@WithConverter(io.quarkus.runtime.configuration.TrimmedStringConverter.class) String> url()The datasource URL -
initialSize
OptionalInt initialSize()The initial size of the pool. Usually you will want to set the initial size to match at least the minimal size, but this is not enforced so to allow for architectures which prefer a lazy initialization of the connections on boot, while being able to sustain a minimal pool size after boot. -
minSize
@WithDefault("0") int minSize()The datasource pool minimum size -
maxSize
@WithDefault("50") int maxSize()The datasource pool maximum size -
backgroundValidationInterval
The interval at which we validate idle connections in the background.Set to
0to disable background validation. -
foregroundValidationInterval
Perform foreground validation on connections that have been idle for longer than the specified interval. -
loginTimeout
Maximum time to wait while attempting to connect to a database. The actual implementation of login timeout could be different in various drivers. (e.g. driver could only cover the authentication and not the entire connection creation phase) -
acquisitionTimeout
The timeout before cancelling the acquisition of a new connection -
leakDetectionInterval
@ConfigDocDefault("This feature is disabled by default.") Optional<Duration> leakDetectionInterval()The interval at which we check for connection leaks. -
idleRemovalInterval
The interval at which we try to remove idle connections. -
maxLifetime
@ConfigDocDefault("By default, there is no restriction on the lifespan of a connection.") Optional<Duration> maxLifetime()The max lifetime of a connection. -
transactionIsolationLevel
Optional<io.agroal.api.configuration.AgroalConnectionFactoryConfiguration.TransactionIsolation> transactionIsolationLevel()The transaction isolation level. -
extendedLeakReport
@WithDefault("false") boolean extendedLeakReport()Collect and display extra troubleshooting info on leaked connections. -
flushOnClose
@WithDefault("false") boolean flushOnClose()Allows connections to be flushed upon return to the pool. It's not enabled by default. -
detectStatementLeaks
@WithDefault("true") boolean detectStatementLeaks()When enabled, Agroal will be able to produce a warning when a connection is returned to the pool without the application having closed all open statements. This is unrelated with tracking of open connections. Disable for peak performance, but only when there's high confidence that no leaks are happening. -
newConnectionSql
Query executed when first using a connection. -
validationQuerySql
Query executed to validate a connection. -
validationQueryTimeout
The timeout for the connection validation query -
validateOnBorrow
@WithDefault("false") boolean validateOnBorrow()Forces connection validation prior to acquisition (foreground validation) regardless of the idle status.Because of the overhead of performing validation on every call, it’s recommended to rely on default idle validation instead, and to leave this to `false`.
-
poolingEnabled
@WithDefault("true") boolean poolingEnabled()Disable pooling to prevent reuse of Connections. Use this when an external pool manages the life-cycle of Connections. -
enableRecovery
@WithDefault("true") boolean enableRecovery()Whether to enable recovery for this datasource.Normally a transaction manager will call xa_recover () on an XA connection during recovery to obtain a list of transaction branches that are currently in a prepared or heuristically completed state. However, it can happen that multiple XA connections connect to the same datasource which would all return the same set of branches and for reasons of improved performance only one should be used for recover() calls. The default value for this configuration property is true because when there is only one connection it is vital for data consistency that the connection is able to report its list of prepared or heuristically completed branches.
-
transactionRequirement
Optional<io.agroal.api.configuration.AgroalConnectionPoolConfiguration.TransactionRequirement> transactionRequirement()Require an active transaction when acquiring a connection. Recommended for production. WARNING: Some extensions acquire connections without holding a transaction for things like schema updates and schema validation. Setting this setting to STRICT may lead to failures in those cases. -
multipleAcquisition
@ConfigDocDefault("By default, multiple acquisition is allowed without any restriction.") @WithDefault("lenient") io.agroal.api.configuration.AgroalConnectionPoolConfiguration.MultipleAcquisitionAction multipleAcquisition()Defines the behavior when a thread tries to acquire multiple connections from the pool.lenient(the default) means no restriction.warnwill log a warning when a thread already holds a connection and tries to acquire another one.strictwill throw an exception in that situation. -
additionalJdbcProperties
Other unspecified properties to be passed to the JDBC driver when creating new connections. -
telemetry
DataSourceJdbcTelemetryConfig telemetry()OpenTelemetry JDBC instrumentation configuration. -
enableKeepAlive
Enable KeepAlive for this datasource. When enabled, the datasource will attempt to keep connections alive by sending periodic keep-alive messages to the database. Each JDBC driver has its own implementation of keep-alive, and the actual behavior may vary depending on the driver and database being used. -
readTimeout
The timeout value used for socket read operations. If reading from the server takes longer than this value, the connection is closed. -
networkTimeout
Sets the maximum duration a connection will wait for the database to reply to any one request, using the standard JDBC 4.1Connection.setNetworkTimeout(java.util.concurrent.Executor, int)API.Unlike
readTimeout, which operates at the socket/driver level for individual read operations, this timeout is managed by the JDBCConnectionobject and applies to any pending database request on the connection, making it the more portable option.
-