Skip to content

Commit

Permalink
Merge pull request #18940 from barreiro/leak-report
Browse files Browse the repository at this point in the history
Expose Agroal feature: enhanced leak report
  • Loading branch information
Sanne authored Aug 9, 2021
2 parents 56d4ae5 + 5062013 commit e59b466
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public void onConnectionCreation(Connection connection) {
log.tracev("{0}: Created connection {1}", datasourceName, connection);
}

@Override
public void onConnectionLeak(Connection connection, Thread thread) {
log.infov("{0}: Connection leak of {1}", datasourceName, connection);
}

@Override
public void onConnectionReap(Connection connection) {
log.tracev("{0}: Closing idle connection {1}", datasourceName, connection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ public class DataSourceJdbcRuntimeConfig {
@ConfigItem
public Optional<AgroalConnectionFactoryConfiguration.TransactionIsolation> transactionIsolationLevel = Optional.empty();

/**
* Collect and display extra troubleshooting info on leaked connections.
*/
@ConfigItem
public boolean extendedLeakReport;

/**
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ public boolean isValid(Connection connection) {
if (dataSourceJdbcRuntimeConfig.maxLifetime.isPresent()) {
poolConfiguration.maxLifetime(dataSourceJdbcRuntimeConfig.maxLifetime.get());
}
poolConfiguration.enhancedLeakReport(dataSourceJdbcRuntimeConfig.extendedLeakReport);
}

public DataSourceBuildTimeConfig getDataSourceBuildTimeConfig(String dataSourceName) {
Expand Down

0 comments on commit e59b466

Please sign in to comment.