diff options
4 files changed, 32 insertions, 6 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/ProcessConstants.java b/server/sonar-process/src/main/java/org/sonar/process/ProcessConstants.java index 2d1a524e3fc..7c33816255e 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/ProcessConstants.java +++ b/server/sonar-process/src/main/java/org/sonar/process/ProcessConstants.java @@ -35,6 +35,12 @@ public interface ProcessConstants { String JDBC_LOGIN = "sonar.jdbc.username"; String JDBC_PASSWORD = "sonar.jdbc.password"; String JDBC_DRIVER_PATH = "sonar.jdbc.driverPath"; + String JDBC_MAX_ACTIVE = "sonar.jdbc.maxActive"; + String JDBC_MAX_IDLE = "sonar.jdbc.maxIdle"; + String JDBC_MIN_IDLE = "sonar.jdbc.minIdle"; + String JDBC_MAX_WAIT = "sonar.jdbc.maxWait"; + String JDBC_MIN_EVICTABLE_IDLE_TIME_MILLIS = "sonar.jdbc.minEvictableIdleTimeMillis"; + String JDBC_TIME_BETWEEN_EVICTION_RUNS_MILLIS = "sonar.jdbc.timeBetweenEvictionRunsMillis"; String PATH_DATA = "sonar.path.data"; String PATH_HOME = "sonar.path.home"; diff --git a/sonar-application/src/main/assembly/conf/sonar.properties b/sonar-application/src/main/assembly/conf/sonar.properties index 4c720ee9982..ba48400d9f3 100644 --- a/sonar-application/src/main/assembly/conf/sonar.properties +++ b/sonar-application/src/main/assembly/conf/sonar.properties @@ -50,12 +50,25 @@ #----- Connection pool settings -sonar.jdbc.maxActive=20 -sonar.jdbc.maxIdle=5 -sonar.jdbc.minIdle=2 -sonar.jdbc.maxWait=5000 -sonar.jdbc.minEvictableIdleTimeMillis=600000 -sonar.jdbc.timeBetweenEvictionRunsMillis=30000 +# The maximum number of active connections that can be allocated +# at the same time, or negative for no limit. +#sonar.jdbc.maxActive=50 + +# The maximum number of connections that can remain idle in the +# pool, without extra ones being released, or negative for no limit. +#sonar.jdbc.maxIdle=5 + +# The minimum number of connections that can remain idle in the pool, +# without extra ones being created, or zero to create none. +#sonar.jdbc.minIdle=2 + +# The maximum number of milliseconds that the pool will wait (when there +# are no available connections) for a connection to be returned before +# throwing an exception, or <= 0 to wait indefinitely. +#sonar.jdbc.maxWait=5000 + +#sonar.jdbc.minEvictableIdleTimeMillis=600000 +#sonar.jdbc.timeBetweenEvictionRunsMillis=30000 diff --git a/sonar-application/src/main/java/org/sonar/application/DefaultSettings.java b/sonar-application/src/main/java/org/sonar/application/DefaultSettings.java index cfb395a8f8b..ede244379cf 100644 --- a/sonar-application/src/main/java/org/sonar/application/DefaultSettings.java +++ b/sonar-application/src/main/java/org/sonar/application/DefaultSettings.java @@ -68,6 +68,12 @@ class DefaultSettings { defaults.put(ProcessConstants.JDBC_URL, "jdbc:h2:tcp://localhost:9092/sonar"); defaults.put(ProcessConstants.JDBC_LOGIN, "sonar"); defaults.put(ProcessConstants.JDBC_PASSWORD, "sonar"); + defaults.put(ProcessConstants.JDBC_MAX_ACTIVE, "50"); + defaults.put(ProcessConstants.JDBC_MAX_IDLE, "5"); + defaults.put(ProcessConstants.JDBC_MIN_IDLE, "2"); + defaults.put(ProcessConstants.JDBC_MAX_WAIT, "5000"); + defaults.put(ProcessConstants.JDBC_MIN_EVICTABLE_IDLE_TIME_MILLIS, "600000"); + defaults.put(ProcessConstants.JDBC_TIME_BETWEEN_EVICTION_RUNS_MILLIS, "30000"); return defaults; } diff --git a/sonar-application/src/test/java/org/sonar/application/DefaultSettingsTest.java b/sonar-application/src/test/java/org/sonar/application/DefaultSettingsTest.java index 82969821f62..317c6fd7f04 100644 --- a/sonar-application/src/test/java/org/sonar/application/DefaultSettingsTest.java +++ b/sonar-application/src/test/java/org/sonar/application/DefaultSettingsTest.java @@ -36,6 +36,7 @@ public class DefaultSettingsTest { assertThat(props.value("sonar.search.javaOpts")).contains("-Xmx"); assertThat(props.value("sonar.jdbc.username")).isEqualTo("sonar"); + assertThat(props.valueAsInt("sonar.jdbc.maxActive")).isEqualTo(50); } @Test |