Skip to content

Commit

Permalink
Add more overrides for hikari properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefano Zilli authored and Coduz committed Jun 24, 2024
1 parent 347db17 commit 66b409d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ public static HikariDataSource getDataSource() {
hikariDataSource.setMinimumIdle(config.getInt(SystemSettingKey.DB_POOL_SIZE_MIN, 1));
hikariDataSource.setIdleTimeout(config.getInt(SystemSettingKey.DB_POOL_IDLE_TIMEOUT, 180000));
hikariDataSource.setKeepaliveTime(config.getInt(SystemSettingKey.DB_POOL_KEEPALIVE_TIME, 30000));
hikariDataSource.setMaxLifetime(config.getInt(SystemSettingKey.DB_POOL_MAX_LIFETIME, 1800000));
hikariDataSource.setConnectionTestQuery(config.getString(SystemSettingKey.DB_POOL_TEST_QUERY, "SELECT 1"));

hikariDataSource.setLeakDetectionThreshold(config.getInt(SystemSettingKey.DB_POOL_LEAKDETECTION_THRESHOLD, 0));
}
return hikariDataSource;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,17 @@ public enum SystemSettingKey implements SettingKey {
*/
DB_POOL_KEEPALIVE_TIME("commons.db.pool.keepalive.timeout"),
/**
* Database pool test query used for connection liveness tests and keepalive
* Database pool maximum lifetime of a connection
*/
DB_POOL_MAX_LIFETIME("commons.db.pool.max.lifetime"),
/**
* Test query used for connection liveness tests and keepalive
*/
DB_POOL_TEST_QUERY("commons.db.pool.test.query"),
/**
* Amount of time that a connection can be out of the pool before a message is logged
*/
DB_POOL_LEAKDETECTION_THRESHOLD("commons.db.pool.leakdetection.threshold"),

/**
* Broker schema (e.g. mqtt, mqtts, ..)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public void keyTest() {
systemSettings.put(SystemSettingKey.DB_POOL_SIZE_MAX, "commons.db.pool.size.max");
systemSettings.put(SystemSettingKey.DB_POOL_IDLE_TIMEOUT, "commons.db.pool.idle.timeout");
systemSettings.put(SystemSettingKey.DB_POOL_KEEPALIVE_TIME, "commons.db.pool.keepalive.timeout");
systemSettings.put(SystemSettingKey.DB_POOL_MAX_LIFETIME, "commons.db.pool.max.lifetime");
systemSettings.put(SystemSettingKey.DB_POOL_TEST_QUERY, "commons.db.pool.test.query");
systemSettings.put(SystemSettingKey.DB_POOL_LEAKDETECTION_THRESHOLD, "commons.db.pool.leakdetection.threshold");
systemSettings.put(SystemSettingKey.DB_CHARACTER_ESCAPE, "commons.db.character.escape");
systemSettings.put(SystemSettingKey.DB_CHARACTER_WILDCARD_ANY, "commons.db.character.wildcard.any");
systemSettings.put(SystemSettingKey.DB_CHARACTER_WILDCARD_SINGLE, "commons.db.character.wildcard.single");
Expand Down

0 comments on commit 66b409d

Please sign in to comment.