diff options
17 files changed, 285 insertions, 52 deletions
diff --git a/build.gradle b/build.gradle index 7ddc1f035b9..18051ec7d05 100644 --- a/build.gradle +++ b/build.gradle @@ -102,7 +102,6 @@ subprojects { exclude 'commons-logging:commons-logging' } dependency 'commons-codec:commons-codec:1.8' - dependency 'commons-dbcp:commons-dbcp:1.4' dependency 'commons-dbutils:commons-dbutils:1.5' dependency 'commons-io:commons-io:2.6' dependency 'commons-lang:commons-lang:2.6' @@ -141,6 +140,7 @@ subprojects { dependency 'net.jpountz.lz4:lz4:1.3.0' dependency 'org.apache.commons:commons-csv:1.4' dependency 'org.apache.commons:commons-email:1.5' + dependency 'org.apache.commons:commons-dbcp2:2.5.0' dependency('org.apache.httpcomponents:httpclient:4.5.2'){ exclude 'commons-logging:commons-logging' } @@ -208,7 +208,7 @@ subprojects { entry 'log4j-over-slf4j' entry 'slf4j-api' } - dependency 'org.postgresql:postgresql:42.2.2' + dependency 'org.postgresql:postgresql:42.2.5' dependency 'org.reflections:reflections:0.9.9' dependency 'org.simpleframework:simple:4.1.21' dependency 'org.sonarsource.orchestrator:sonar-orchestrator:3.21.0.1721' diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeDatabaseMBeanImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeDatabaseMBeanImpl.java index 85f7cce76de..2a994866783 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeDatabaseMBeanImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeDatabaseMBeanImpl.java @@ -19,7 +19,7 @@ */ package org.sonar.ce.monitoring; -import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.dbcp2.BasicDataSource; import org.picocontainer.Startable; import org.sonar.db.DbClient; import org.sonar.process.Jmx; @@ -53,7 +53,7 @@ public class CeDatabaseMBeanImpl implements CeDatabaseMBean, Startable, SystemIn @Override public int getPoolMaxActiveConnections() { - return commonsDbcp().getMaxActive(); + return commonsDbcp().getMaxTotal(); } @Override @@ -78,12 +78,12 @@ public class CeDatabaseMBeanImpl implements CeDatabaseMBean, Startable, SystemIn @Override public long getPoolMaxWaitMillis() { - return commonsDbcp().getMaxWait(); + return commonsDbcp().getMaxWaitMillis(); } @Override public boolean getPoolRemoveAbandoned() { - return commonsDbcp().getRemoveAbandoned(); + return commonsDbcp().getRemoveAbandonedOnBorrow(); } @Override diff --git a/server/sonar-db-core/build.gradle b/server/sonar-db-core/build.gradle index 10a0e9f4718..9fcef14168c 100644 --- a/server/sonar-db-core/build.gradle +++ b/server/sonar-db-core/build.gradle @@ -10,7 +10,7 @@ dependencies { compile 'ch.qos.logback:logback-classic' compile 'ch.qos.logback:logback-core' compile 'commons-codec:commons-codec' - compile 'commons-dbcp:commons-dbcp' + compile 'org.apache.commons:commons-dbcp2' compile 'commons-dbutils:commons-dbutils' compile 'net.jpountz.lz4:lz4' compile 'org.apache.commons:commons-csv' diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java b/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java index 0e9c5d1169e..eaca483020b 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java @@ -318,8 +318,20 @@ public class DatabaseUtils { private static boolean doTableExists(String table, Connection connection) { // table type is used to speed-up Oracle by removing introspection of system tables and aliases. - try (ResultSet rs = connection.getMetaData().getTables(null, null, table, TABLE_TYPE)) { + try (ResultSet rs = connection.getMetaData().getTables(connection.getCatalog(), connection.getSchema(), table, TABLE_TYPE)) { + System.out.println("****>> " + rs.getMetaData().getSchemaName(1)); + System.out.println("****>>> " + connection.getSchema()); while (rs.next()) { + System.out.println("TABLE_CAT = " + rs.getString("TABLE_CAT")); + System.out.println("TABLE_SCHEM = " + rs.getString("TABLE_SCHEM")); + System.out.println("TABLE_NAME = " + rs.getString("TABLE_NAME")); + System.out.println("TABLE_TYPE = " + rs.getString("TABLE_TYPE")); + System.out.println("REMARKS = " + rs.getString("REMARKS")); + //System.out.println("TYPE_CAT = " + rs.getString("TYPE_CAT")); + //System.out.println("TYPE_SCHEM = " + rs.getString("TYPE_SCHEM")); + //System.out.println("TYPE_NAME = " + rs.getString("TYPE_NAME")); + System.out.println("SELF_REFERENCING_COL_NAME = " + rs.getString("SELF_REFERENCING_COL_NAME")); + System.out.println("REF_GENERATION = " + rs.getString("REF_GENERATION")); String name = rs.getString("TABLE_NAME"); if (table.equalsIgnoreCase(name)) { return true; diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java b/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java index 06259361d70..90ad11a5789 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java @@ -27,8 +27,8 @@ import java.util.List; import java.util.Map; import java.util.Properties; import javax.sql.DataSource; -import org.apache.commons.dbcp.BasicDataSource; -import org.apache.commons.dbcp.BasicDataSourceFactory; +import org.apache.commons.dbcp2.BasicDataSource; +import org.apache.commons.dbcp2.BasicDataSourceFactory; import org.apache.commons.dbutils.DbUtils; import org.apache.commons.lang.StringUtils; import org.sonar.api.config.Settings; diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ConnectionInterceptor.java b/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ConnectionInterceptor.java index c9bc8184f26..98b17e1f8fd 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ConnectionInterceptor.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ConnectionInterceptor.java @@ -21,7 +21,7 @@ package org.sonar.db.profiling; import java.sql.Connection; import java.sql.SQLException; -import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.dbcp2.BasicDataSource; public interface ConnectionInterceptor { diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/profiling/NullConnectionInterceptor.java b/server/sonar-db-core/src/main/java/org/sonar/db/profiling/NullConnectionInterceptor.java index 3e50ed9ac49..68e2a8c3728 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/profiling/NullConnectionInterceptor.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/profiling/NullConnectionInterceptor.java @@ -21,7 +21,7 @@ package org.sonar.db.profiling; import java.sql.Connection; import java.sql.SQLException; -import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.dbcp2.BasicDataSource; public enum NullConnectionInterceptor implements ConnectionInterceptor { INSTANCE; diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfiledConnectionInterceptor.java b/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfiledConnectionInterceptor.java index 0dff4eac332..17021b079db 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfiledConnectionInterceptor.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfiledConnectionInterceptor.java @@ -22,7 +22,7 @@ package org.sonar.db.profiling; import java.lang.reflect.Proxy; import java.sql.Connection; import java.sql.SQLException; -import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.dbcp2.BasicDataSource; public enum ProfiledConnectionInterceptor implements ConnectionInterceptor { INSTANCE; diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfiledDataSource.java b/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfiledDataSource.java index 2c0fa00317f..d6391d472fc 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfiledDataSource.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfiledDataSource.java @@ -21,9 +21,14 @@ package org.sonar.db.profiling; import java.io.PrintWriter; import java.sql.Connection; +import java.sql.Driver; import java.sql.SQLException; import java.util.Collection; -import org.apache.commons.dbcp.BasicDataSource; +import java.util.List; +import java.util.Set; +import javax.management.MBeanServer; +import javax.management.ObjectName; +import org.apache.commons.dbcp2.BasicDataSource; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; @@ -48,26 +53,16 @@ public class ProfiledDataSource extends BasicDataSource { } @Override - public boolean getDefaultAutoCommit() { + public Boolean getDefaultAutoCommit() { return delegate.getDefaultAutoCommit(); } @Override - public void setDefaultAutoCommit(boolean defaultAutoCommit) { - delegate.setDefaultAutoCommit(defaultAutoCommit); - } - - @Override - public boolean getDefaultReadOnly() { + public Boolean getDefaultReadOnly() { return delegate.getDefaultReadOnly(); } @Override - public void setDefaultReadOnly(boolean defaultReadOnly) { - delegate.setDefaultReadOnly(defaultReadOnly); - } - - @Override public int getDefaultTransactionIsolation() { return delegate.getDefaultTransactionIsolation(); } @@ -108,13 +103,13 @@ public class ProfiledDataSource extends BasicDataSource { } @Override - public synchronized int getMaxActive() { - return delegate.getMaxActive(); + public synchronized int getMaxTotal() { + return delegate.getMaxTotal(); } @Override - public synchronized void setMaxActive(int maxActive) { - delegate.setMaxActive(maxActive); + public synchronized void setMaxTotal(int maxActive) { + delegate.setMaxTotal(maxActive); } @Override @@ -148,13 +143,13 @@ public class ProfiledDataSource extends BasicDataSource { } @Override - public synchronized long getMaxWait() { - return delegate.getMaxWait(); + public synchronized long getMaxWaitMillis() { + return delegate.getMaxWaitMillis(); } @Override - public synchronized void setMaxWait(long maxWait) { - delegate.setMaxWait(maxWait); + public synchronized void setMaxWaitMillis(long maxWait) { + delegate.setMaxWaitMillis(maxWait); } @Override @@ -298,12 +293,12 @@ public class ProfiledDataSource extends BasicDataSource { } @Override - public Collection getConnectionInitSqls() { + public List<String> getConnectionInitSqls() { return delegate.getConnectionInitSqls(); } @Override - public void setConnectionInitSqls(Collection connectionInitSqls) { + public void setConnectionInitSqls(Collection<String> connectionInitSqls) { delegate.setConnectionInitSqls(connectionInitSqls); } @@ -353,13 +348,24 @@ public class ProfiledDataSource extends BasicDataSource { } @Override - public boolean getRemoveAbandoned() { - return delegate.getRemoveAbandoned(); + public boolean getRemoveAbandonedOnBorrow() { + return delegate.getRemoveAbandonedOnBorrow(); } @Override - public void setRemoveAbandoned(boolean removeAbandoned) { - delegate.setRemoveAbandoned(removeAbandoned); + public void setRemoveAbandonedOnBorrow(boolean removeAbandoned) { + delegate.setRemoveAbandonedOnBorrow(removeAbandoned); + } + + + @Override + public boolean getRemoveAbandonedOnMaintenance() { + return delegate.getRemoveAbandonedOnMaintenance(); + } + + @Override + public void setRemoveAbandonedOnMaintenance(boolean removeAbandoned) { + delegate.setRemoveAbandonedOnMaintenance(removeAbandoned); } @Override @@ -416,4 +422,219 @@ public class ProfiledDataSource extends BasicDataSource { public <T> T unwrap(Class<T> iface) throws SQLException { return delegate.unwrap(iface); } + + @Override + public void setDefaultAutoCommit(Boolean defaultAutoCommit) { + delegate.setDefaultAutoCommit(defaultAutoCommit); + } + + @Override + public void setDefaultReadOnly(Boolean defaultReadOnly) { + delegate.setDefaultReadOnly(defaultReadOnly); + } + + @Override + public Integer getDefaultQueryTimeout() { + return delegate.getDefaultQueryTimeout(); + } + + @Override + public void setDefaultQueryTimeout(Integer defaultQueryTimeoutSeconds) { + delegate.setDefaultQueryTimeout(defaultQueryTimeoutSeconds); + } + + @Override + public String getDefaultSchema() { + return delegate.getDefaultSchema(); + } + + @Override + public void setDefaultSchema(String defaultSchema) { + delegate.setDefaultSchema(defaultSchema); + } + + @Override + public boolean getCacheState() { + return delegate.getCacheState(); + } + + @Override + public void setCacheState(boolean cacheState) { + delegate.setCacheState(cacheState); + } + + @Override + public synchronized Driver getDriver() { + return delegate.getDriver(); + } + + @Override + public synchronized void setDriver(Driver driver) { + delegate.setDriver(driver); + } + + @Override + public synchronized boolean getLifo() { + return delegate.getLifo(); + } + + @Override + public synchronized void setLifo(boolean lifo) { + delegate.setLifo(lifo); + } + + @Override + public synchronized boolean getTestOnCreate() { + return delegate.getTestOnCreate(); + } + + @Override + public synchronized void setTestOnCreate(boolean testOnCreate) { + delegate.setTestOnCreate(testOnCreate); + } + + @Override + public synchronized void setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis) { + delegate.setSoftMinEvictableIdleTimeMillis(softMinEvictableIdleTimeMillis); + } + + @Override + public synchronized long getSoftMinEvictableIdleTimeMillis() { + return delegate.getSoftMinEvictableIdleTimeMillis(); + } + + @Override + public synchronized String getEvictionPolicyClassName() { + return delegate.getEvictionPolicyClassName(); + } + + @Override + public synchronized void setEvictionPolicyClassName(String evictionPolicyClassName) { + delegate.setEvictionPolicyClassName(evictionPolicyClassName); + } + + @Override + public String[] getConnectionInitSqlsAsArray() { + return delegate.getConnectionInitSqlsAsArray(); + } + + @Override + public long getMaxConnLifetimeMillis() { + return delegate.getMaxConnLifetimeMillis(); + } + + @Override + public boolean getLogExpiredConnections() { + return delegate.getLogExpiredConnections(); + } + + @Override + public void setMaxConnLifetimeMillis(long maxConnLifetimeMillis) { + delegate.setMaxConnLifetimeMillis(maxConnLifetimeMillis); + } + + @Override + public void setLogExpiredConnections(boolean logExpiredConnections) { + delegate.setLogExpiredConnections(logExpiredConnections); + } + + @Override + public String getJmxName() { + return delegate.getJmxName(); + } + + @Override + public void setJmxName(String jmxName) { + delegate.setJmxName(jmxName); + } + + @Override + public boolean getEnableAutoCommitOnReturn() { + return delegate.getEnableAutoCommitOnReturn(); + } + + @Override + public void setEnableAutoCommitOnReturn(boolean enableAutoCommitOnReturn) { + delegate.setEnableAutoCommitOnReturn(enableAutoCommitOnReturn); + } + + @Override + public boolean getRollbackOnReturn() { + return delegate.getRollbackOnReturn(); + } + + @Override + public void setRollbackOnReturn(boolean rollbackOnReturn) { + delegate.setRollbackOnReturn(rollbackOnReturn); + } + + @Override + public Set<String> getDisconnectionSqlCodes() { + return delegate.getDisconnectionSqlCodes(); + } + + @Override + public String[] getDisconnectionSqlCodesAsArray() { + return delegate.getDisconnectionSqlCodesAsArray(); + } + + @Override + public void setDisconnectionSqlCodes(Collection<String> disconnectionSqlCodes) { + delegate.setDisconnectionSqlCodes(disconnectionSqlCodes); + } + + @Override + public boolean getFastFailValidation() { + return delegate.getFastFailValidation(); + } + + @Override + public void setFastFailValidation(boolean fastFailValidation) { + delegate.setFastFailValidation(fastFailValidation); + } + + @Override + public PrintWriter getAbandonedLogWriter() { + return delegate.getAbandonedLogWriter(); + } + + @Override + public void setAbandonedLogWriter(PrintWriter logWriter) { + delegate.setAbandonedLogWriter(logWriter); + } + + @Override + public boolean getAbandonedUsageTracking() { + return delegate.getAbandonedUsageTracking(); + } + + @Override + public void setAbandonedUsageTracking(boolean usageTracking) { + delegate.setAbandonedUsageTracking(usageTracking); + } + + @Override + public void invalidateConnection(Connection connection) { + delegate.invalidateConnection(connection); + } + + @Override + public ObjectName preRegister(MBeanServer server, ObjectName objectName) { + return delegate.preRegister(server, objectName); + } + + @Override + public void postRegister(Boolean registrationDone) { + delegate.postRegister(registrationDone); + } + + @Override + public void preDeregister() throws Exception { + delegate.preDeregister(); + } + + @Override + public void postDeregister() { + delegate.postDeregister(); + } } diff --git a/server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java b/server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java index d3c9ca7519b..f831bc110da 100644 --- a/server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java +++ b/server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java @@ -20,7 +20,7 @@ package org.sonar.db; import java.util.Properties; -import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.dbcp2.BasicDataSource; import org.junit.Test; import org.sonar.api.config.Settings; import org.sonar.api.config.internal.MapSettings; @@ -89,7 +89,7 @@ public class DefaultDatabaseTest { db.stop(); assertThat(db.getDialect().getId()).isEqualTo("h2"); - assertThat(((BasicDataSource) db.getDataSource()).getMaxActive()).isEqualTo(1); + assertThat(((BasicDataSource) db.getDataSource()).getMaxTotal()).isEqualTo(8); } @Test diff --git a/server/sonar-db-core/src/test/java/org/sonar/db/H2Database.java b/server/sonar-db-core/src/test/java/org/sonar/db/H2Database.java index 2c9866f67e3..a9192713eab 100644 --- a/server/sonar-db-core/src/test/java/org/sonar/db/H2Database.java +++ b/server/sonar-db-core/src/test/java/org/sonar/db/H2Database.java @@ -22,7 +22,7 @@ package org.sonar.db; import java.sql.Connection; import java.sql.SQLException; import javax.sql.DataSource; -import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.dbcp2.BasicDataSource; import org.apache.commons.dbutils.DbUtils; import org.sonar.db.dialect.Dialect; import org.sonar.db.dialect.H2; diff --git a/server/sonar-db-core/src/test/java/org/sonar/db/profiling/ProfiledDataSourceTest.java b/server/sonar-db-core/src/test/java/org/sonar/db/profiling/ProfiledDataSourceTest.java index ede91489b4a..93553f41cb4 100644 --- a/server/sonar-db-core/src/test/java/org/sonar/db/profiling/ProfiledDataSourceTest.java +++ b/server/sonar-db-core/src/test/java/org/sonar/db/profiling/ProfiledDataSourceTest.java @@ -27,7 +27,7 @@ import java.sql.Date; import java.sql.PreparedStatement; import java.sql.Statement; import java.sql.Timestamp; -import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.dbcp2.BasicDataSource; import org.junit.Rule; import org.junit.Test; import org.sonar.api.utils.log.LogTester; diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/DbTester.java b/server/sonar-db-dao/src/test/java/org/sonar/db/DbTester.java index 2081a83f136..15f11f5d2d0 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/DbTester.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/DbTester.java @@ -24,7 +24,7 @@ import java.sql.SQLException; import java.util.List; import java.util.Map; import javax.annotation.Nullable; -import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.dbcp2.BasicDataSource; import org.apache.commons.lang.StringUtils; import org.picocontainer.containers.TransientPicoContainer; import org.sonar.api.utils.System2; diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/DataChangeTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/DataChangeTest.java index b754d233377..08948c726ef 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/DataChangeTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/DataChangeTest.java @@ -306,7 +306,7 @@ public class DataChangeTest { .setString(2, "login" + i) .setInt(3, 10 + i) .setBoolean(4, true) - .setDouble(4, i + 0.5) + .setDouble(5, i + 0.5) .addBatch(); } upsert.execute().commit().close(); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/DropOldLicensesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/DropOldLicensesTest.java index 21601701f0a..9574e51f7a4 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/DropOldLicensesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/DropOldLicensesTest.java @@ -66,7 +66,7 @@ public class DropOldLicensesTest { .stream() .map(map -> (String)map.get("PROP_KEY")) .collect(Collectors.toList())) - .containsExactly(expectedSettingKeys); + .containsExactlyInAnyOrder(expectedSettingKeys); } public void insertProperty(String propertyKey) { diff --git a/server/sonar-server/build.gradle b/server/sonar-server/build.gradle index 1efcb4d3026..19d0f661aa4 100644 --- a/server/sonar-server/build.gradle +++ b/server/sonar-server/build.gradle @@ -32,13 +32,13 @@ dependencies { compile 'com.google.protobuf:protobuf-java' compile 'com.googlecode.java-diff-utils:diffutils' compile 'com.hazelcast:hazelcast-client' - compile 'commons-dbcp:commons-dbcp' compile 'commons-dbutils:commons-dbutils' compile 'io.jsonwebtoken:jjwt' compile 'javax.xml.bind:jaxb-api' compile 'org.apache.httpcomponents:httpclient' compile 'org.apache.logging.log4j:log4j-api' compile 'org.apache.tomcat.embed:tomcat-embed-core' + compile 'org.apache.commons:commons-dbcp2' compile 'org.elasticsearch.client:transport' compile 'org.picocontainer:picocontainer' compile 'org.slf4j:jul-to-slf4j' diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/DbConnectionSection.java b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/DbConnectionSection.java index 6f2d05eb11b..5a37f672929 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/DbConnectionSection.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/DbConnectionSection.java @@ -19,7 +19,7 @@ */ package org.sonar.server.platform.monitoring; -import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.dbcp2.BasicDataSource; import org.sonar.api.SonarQubeSide; import org.sonar.api.SonarRuntime; import org.sonar.db.DbClient; @@ -60,7 +60,7 @@ public class DbConnectionSection extends BaseSectionMBean implements DbConnectio @Override public int getPoolMaxActiveConnections() { - return commonsDbcp().getMaxActive(); + return commonsDbcp().getMaxTotal(); } @Override @@ -85,12 +85,12 @@ public class DbConnectionSection extends BaseSectionMBean implements DbConnectio @Override public long getPoolMaxWaitMillis() { - return commonsDbcp().getMaxWait(); + return commonsDbcp().getMaxWaitMillis(); } @Override public boolean getPoolRemoveAbandoned() { - return commonsDbcp().getRemoveAbandoned(); + return commonsDbcp().getRemoveAbandonedOnBorrow(); } @Override |