Replace c3p0 with dbcp2, so there is only one pooling library in use
This commit is contained in:
parent
6cbdcd6842
commit
4543e65d08
3 changed files with 31 additions and 32 deletions
|
@ -26,7 +26,7 @@ import org.apache.jena.sdb.sql.SDBConnection;
|
|||
import org.apache.jena.sdb.store.DatabaseType;
|
||||
import org.apache.jena.sdb.store.LayoutType;
|
||||
import org.apache.jena.sdb.util.StoreUtils;
|
||||
import com.mchange.v2.c3p0.ComboPooledDataSource;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.RDFServiceDataset;
|
||||
|
@ -86,7 +86,7 @@ public class ContentTripleSourceSDB extends ContentTripleSource {
|
|||
static final boolean DEFAULT_TESTONRETURN = true;
|
||||
|
||||
private ServletContext ctx;
|
||||
private ComboPooledDataSource ds;
|
||||
private BasicDataSource ds;
|
||||
private RDFServiceFactory rdfServiceFactory;
|
||||
private RDFService rdfService;
|
||||
private Dataset dataset;
|
||||
|
@ -233,10 +233,14 @@ public class ContentTripleSourceSDB extends ContentTripleSource {
|
|||
this.rdfService.close();
|
||||
}
|
||||
if (ds != null) {
|
||||
String driverClassName = ds.getDriverClass();
|
||||
ds.close();
|
||||
attemptToDeregisterJdbcDriver(driverClassName);
|
||||
cleanupAbandonedConnectionThread(driverClassName);
|
||||
String driverClassName = ds.getDriverClassName();
|
||||
try {
|
||||
ds.close();
|
||||
} catch (SQLException e) {
|
||||
}finally {
|
||||
attemptToDeregisterJdbcDriver(driverClassName);
|
||||
cleanupAbandonedConnectionThread(driverClassName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.mchange.v2.c3p0.ComboPooledDataSource;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||
|
||||
|
@ -48,26 +48,26 @@ public class SDBDataSource {
|
|||
this.configProps = ConfigurationProperties.getBean(ctx);
|
||||
}
|
||||
|
||||
public ComboPooledDataSource getDataSource() {
|
||||
try {
|
||||
ComboPooledDataSource cpds = new ComboPooledDataSource();
|
||||
cpds.setDriverClass(getDbDriverClassName());
|
||||
cpds.setJdbcUrl(getJdbcUrl());
|
||||
cpds.setUser(configProps.getProperty(PROPERTY_DB_USERNAME));
|
||||
cpds.setPassword(configProps.getProperty(PROPERTY_DB_PASSWORD));
|
||||
cpds.setMaxPoolSize(getMaxActive());
|
||||
cpds.setMinPoolSize(getMaxIdle());
|
||||
cpds.setMaxIdleTime(getMaxIdleTime());
|
||||
cpds.setMaxIdleTimeExcessConnections(getMaxIdleTimeExcess());
|
||||
cpds.setAcquireIncrement(5);
|
||||
cpds.setNumHelperThreads(6);
|
||||
cpds.setTestConnectionOnCheckout(DEFAULT_TESTONBORROW);
|
||||
cpds.setTestConnectionOnCheckin(DEFAULT_TESTONRETURN);
|
||||
cpds.setPreferredTestQuery(getValidationQuery());
|
||||
return cpds;
|
||||
} catch (PropertyVetoException pve) {
|
||||
throw new RuntimeException(pve);
|
||||
}
|
||||
public BasicDataSource getDataSource() {
|
||||
BasicDataSource cpds = new BasicDataSource();
|
||||
cpds.setDriverClassName(getDbDriverClassName());
|
||||
cpds.setUrl(getJdbcUrl());
|
||||
cpds.setUsername(configProps.getProperty(PROPERTY_DB_USERNAME));
|
||||
cpds.setPassword(configProps.getProperty(PROPERTY_DB_PASSWORD));
|
||||
cpds.setMaxTotal(getMaxActive());
|
||||
cpds.setMaxIdle(getMaxIdle());
|
||||
cpds.setMinEvictableIdleTimeMillis(getMaxIdleTime());
|
||||
cpds.setTestOnBorrow(DEFAULT_TESTONBORROW);
|
||||
cpds.setTestOnReturn(DEFAULT_TESTONRETURN);
|
||||
cpds.setValidationQuery(getValidationQuery());
|
||||
return cpds;
|
||||
// try {
|
||||
// cpds.setMaxIdleTimeExcessConnections(getMaxIdleTimeExcess());
|
||||
// cpds.setAcquireIncrement(5);
|
||||
// cpds.setNumHelperThreads(6);
|
||||
// } catch (PropertyVetoException pve) {
|
||||
// throw new RuntimeException(pve);
|
||||
// }
|
||||
}
|
||||
|
||||
private String getDbDriverClassName() {
|
||||
|
|
5
dependencies/pom.xml
vendored
5
dependencies/pom.xml
vendored
|
@ -70,11 +70,6 @@
|
|||
<artifactId>icu4j</artifactId>
|
||||
<version>3.4.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mchange</groupId>
|
||||
<artifactId>c3p0</artifactId>
|
||||
<version>0.9.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||
<artifactId>imageio-jpeg</artifactId>
|
||||
|
|
Loading…
Add table
Reference in a new issue