Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public BaseJdbcExecutor(byte[] thriftParams) throws Exception {
.setConnectionPoolMaxLifeTime(request.connection_pool_max_life_time)
.setConnectionPoolKeepAlive(request.connection_pool_keep_alive);
JdbcDataSource.getDataSource().setCleanupInterval(request.connection_pool_cache_clear_time);
System.setProperty("com.zaxxer.hikari.useWeakReferences", "true");
init(config, request.statement);
this.jdbcDriverVersion = getJdbcDriverVersion();
}
Expand Down Expand Up @@ -308,7 +309,7 @@ private void init(JdbcDataSourceConfig config, String sql) throws JdbcExecutorEx
ds.setKeepaliveTime(config.getConnectionPoolMaxLifeTime() / 5L); // default 6 min
}
hikariDataSource = ds;
JdbcDataSource.getDataSource().putSource(hikariDataSourceKey, ds);
JdbcDataSource.getDataSource().putSource(hikariDataSourceKey, hikariDataSource);
LOG.info("JdbcClient set"
+ " ConnectionPoolMinSize = " + config.getConnectionPoolMinSize()
+ ", ConnectionPoolMaxSize = " + config.getConnectionPoolMaxSize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ public Map<String, HikariDataSource> getSourcesMap() {
}

public void setCleanupInterval(long interval) {
this.cleanupInterval = interval * 1000L;
restartCleanupTask();
if (this.cleanupInterval != interval * 1000L) {
this.cleanupInterval = interval * 1000L;
restartCleanupTask();
}
}

private synchronized void restartCleanupTask() {
Expand Down