documentation: Document database.pool* variables
Also support unit suffixes in the database.poolMaxWait variable, so it behaves more like cache.maxAge does. Change-Id: I68afd787cf813344dbbe2c548f1899af77ceabe4 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -156,6 +156,10 @@ public class ConfigUtil {
|
||||
inputUnit = wantUnit;
|
||||
inputMul = 1;
|
||||
|
||||
} else if (match(unitName, "ms", "milliseconds")) {
|
||||
inputUnit = TimeUnit.MILLISECONDS;
|
||||
inputMul = 1;
|
||||
|
||||
} else if (match(unitName, "s", "sec", "second", "seconds")) {
|
||||
inputUnit = TimeUnit.SECONDS;
|
||||
inputMul = 1;
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
package com.google.gerrit.server.schema;
|
||||
|
||||
import static com.google.gerrit.server.config.ConfigUtil.getEnum;
|
||||
import static java.util.concurrent.TimeUnit.*;
|
||||
|
||||
import com.google.gerrit.lifecycle.LifecycleListener;
|
||||
import com.google.gerrit.server.config.ConfigUtil;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.config.SitePaths;
|
||||
import com.google.gwtorm.jdbc.SimpleDataSource;
|
||||
@@ -184,7 +186,8 @@ public final class DataSourceProvider implements Provider<DataSource>,
|
||||
ds.setMaxActive(cfg.getInt("database", "poollimit", 8));
|
||||
ds.setMinIdle(cfg.getInt("database", "poolminidle", 4));
|
||||
ds.setMaxIdle(cfg.getInt("database", "poolmaxidle", 4));
|
||||
ds.setMaxWait(cfg.getInt("database", "poolmaxwait", 30000));
|
||||
ds.setMaxWait(ConfigUtil.getTimeUnit(cfg, "database", null,
|
||||
"poolmaxwait", MILLISECONDS.convert(30, SECONDS), MILLISECONDS));
|
||||
ds.setInitialSize(ds.getMinIdle());
|
||||
return ds;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user