Adding leak detection to hikari pool. Would be tracking this on logdna to ensure that we are catching any and all leaks that may be occuring with hikari. (#2374)
This commit is contained in:
parent
988ebe975b
commit
051d3c6c7f
|
|
@ -54,6 +54,8 @@ public class PostgresPlugin extends BasePlugin {
|
||||||
|
|
||||||
private static final int MAXIMUM_POOL_SIZE = 5;
|
private static final int MAXIMUM_POOL_SIZE = 5;
|
||||||
|
|
||||||
|
private static final long LEAK_DETECTION_TIME_MS = 60*1000;
|
||||||
|
|
||||||
public PostgresPlugin(PluginWrapper wrapper) {
|
public PostgresPlugin(PluginWrapper wrapper) {
|
||||||
super(wrapper);
|
super(wrapper);
|
||||||
}
|
}
|
||||||
|
|
@ -540,6 +542,10 @@ public class PostgresPlugin extends BasePlugin {
|
||||||
}
|
}
|
||||||
config.setJdbcUrl(url);
|
config.setJdbcUrl(url);
|
||||||
|
|
||||||
|
// Configuring leak detection threshold for 60 seconds. Any connection which hasn't been released in 60 seconds
|
||||||
|
// should get tracked (may be falsely for long running queries) as leaked connection
|
||||||
|
config.setLeakDetectionThreshold(LEAK_DETECTION_TIME_MS);
|
||||||
|
|
||||||
// Now create the connection pool from the configuration
|
// Now create the connection pool from the configuration
|
||||||
HikariDataSource datasource = new HikariDataSource(config);
|
HikariDataSource datasource = new HikariDataSource(config);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user