[PATCH] Upgrade to DBCP 2.1.1
Wald Commits
scm-commit at wald.intevation.org
Fri Aug 14 18:24:09 CEST 2015
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1439569444 -7200
# Node ID 8179cca1796a493bca731358fb53e02e976bc688
# Parent 86da84a95fac12846626f6388aed83e321d51ad6
Upgrade to DBCP 2.1.1
DBCP 2 needs at least Java 7. We are no longer compatible with Java 6.
diff -r 86da84a95fac -r 8179cca1796a artifacts/pom-oracle.xml
--- a/artifacts/pom-oracle.xml Thu Aug 13 18:37:13 2015 +0200
+++ b/artifacts/pom-oracle.xml Fri Aug 14 18:24:04 2015 +0200
@@ -21,8 +21,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>1.7</source>
+ <target>1.7</target>
</configuration>
</plugin>
<plugin>
diff -r 86da84a95fac -r 8179cca1796a artifacts/pom.xml
--- a/artifacts/pom.xml Thu Aug 13 18:37:13 2015 +0200
+++ b/artifacts/pom.xml Fri Aug 14 18:24:04 2015 +0200
@@ -21,8 +21,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>1.7</source>
+ <target>1.7</target>
</configuration>
</plugin>
<plugin>
diff -r 86da84a95fac -r 8179cca1796a backend/pom-oracle.xml
--- a/backend/pom-oracle.xml Thu Aug 13 18:37:13 2015 +0200
+++ b/backend/pom-oracle.xml Fri Aug 14 18:24:04 2015 +0200
@@ -21,8 +21,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>1.7</source>
+ <target>1.7</target>
</configuration>
</plugin>
<plugin>
@@ -101,9 +101,9 @@
<version>1.2.14</version>
</dependency>
<dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- <version>1.4</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-dbcp2</artifactId>
+ <version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.hibernatespatial</groupId>
diff -r 86da84a95fac -r 8179cca1796a backend/pom.xml
--- a/backend/pom.xml Thu Aug 13 18:37:13 2015 +0200
+++ b/backend/pom.xml Fri Aug 14 18:24:04 2015 +0200
@@ -21,8 +21,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>1.7</source>
+ <target>1.7</target>
</configuration>
</plugin>
<plugin>
@@ -101,9 +101,9 @@
<version>1.2.14</version>
</dependency>
<dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- <version>1.4</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-dbcp2</artifactId>
+ <version>2.1.1</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
diff -r 86da84a95fac -r 8179cca1796a backend/src/main/java/org/dive4elements/river/backend/utils/DBCPConnectionProvider.java
--- a/backend/src/main/java/org/dive4elements/river/backend/utils/DBCPConnectionProvider.java Thu Aug 13 18:37:13 2015 +0200
+++ b/backend/src/main/java/org/dive4elements/river/backend/utils/DBCPConnectionProvider.java Fri Aug 14 18:24:04 2015 +0200
@@ -29,11 +29,10 @@
import java.util.Iterator;
import java.util.Properties;
import java.util.Map;
-import java.util.Collections;
-import java.util.StringTokenizer;
+import java.util.Arrays;
-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.log4j.Logger;
@@ -208,8 +207,8 @@
// by the BasicDataSourceFactory if you set it as a dbcpProperty
String connectionInitSqls = props.getProperty("connectionInitSqls");
if (connectionInitSqls != null) {
- StringTokenizer tokenizer = new StringTokenizer(connectionInitSqls, ";");
- ds.setConnectionInitSqls(Collections.list(tokenizer));
+ String[] statements = connectionInitSqls.split(";");
+ ds.setConnectionInitSqls(Arrays.asList(statements));
}
String validationQuery = props.getProperty("validationQuery");
@@ -220,7 +219,7 @@
String maxWait = props.getProperty("maxWait");
if (maxWait != null) {
try {
- ds.setMaxWait(Integer.parseInt(maxWait));
+ ds.setMaxWaitMillis(Integer.parseInt(maxWait));
}
catch (NumberFormatException nfe) {
log.error(
@@ -256,8 +255,8 @@
log.trace("Connection pool parameters:");
log.trace("_ active connections: " + ds.getNumActive());
log.trace("_ idle connections: " + ds.getNumIdle());
- log.trace("_ max active: " + ds.getMaxActive());
- if (ds.getNumActive() == ds.getMaxActive()) {
+ log.trace("_ max active: " + ds.getMaxTotal());
+ if (ds.getNumActive() == ds.getMaxTotal()) {
log.warn("Maximum number of database connections in pool in use!");
}
Connection conn = ds.getConnection();
More information about the Dive4Elements-commits
mailing list