Merge "Change default value of database.poolMaxIdle"

This commit is contained in:
Martin Fick
2015-11-23 22:34:23 +00:00
committed by Gerrit Code Review
2 changed files with 5 additions and 3 deletions

View File

@@ -1423,7 +1423,7 @@ This setting only applies if
Maximum number of connections to keep idle in the pool. If there
are more idle connections, connections will be closed instead of
being returned back to the pool.
Default is 4.
Default is min(<<database.poolLimit, database.poolLimit>>, 16).
+
This setting only applies if
<<database.connectionPool,database.connectionPool>> is true.

View File

@@ -129,9 +129,11 @@ public class DataSourceProvider implements Provider<DataSource>,
if (password != null && !password.isEmpty()) {
ds.setPassword(password);
}
ds.setMaxActive(threadSettingsConfig.getDatabasePoolLimit());
int poolLimit = threadSettingsConfig.getDatabasePoolLimit();
ds.setMaxActive(poolLimit);
ds.setMinIdle(cfg.getInt("database", "poolminidle", 4));
ds.setMaxIdle(cfg.getInt("database", "poolmaxidle", 4));
ds.setMaxIdle(
cfg.getInt("database", "poolmaxidle", Math.min(poolLimit, 16)));
ds.setMaxWait(ConfigUtil.getTimeUnit(cfg, "database", null,
"poolmaxwait", MILLISECONDS.convert(30, SECONDS), MILLISECONDS));
ds.setInitialSize(ds.getMinIdle());