enabling connection testing with C3P0

This commit is contained in:
brianjlowe 2012-08-31 15:14:04 +00:00
parent c0062ce189
commit 0a4262d876
2 changed files with 6 additions and 3 deletions

View file

@ -42,15 +42,15 @@ public class RDBGraphGenerator implements SQLGraphGenerator {
}
public Graph generateGraph() {
log.info("Regenerate the graph.");
try {
// if (log.isDebugEnabled()) {
// log.debug(ds.getNumActive() + " active SQL connections");
// log.debug(ds.getNumIdle() + " idle SQL connections");
// }
if ( ( this.connection == null ) || ( this.connection.isClosed() ) ) {
this.connection = ds.getConnection();
if ( ( this.connection != null ) && ( !this.connection.isClosed() ) ) {
this.connection.close();
}
this.connection = ds.getConnection();
IDBConnection idbConn = new DBConnection(this.connection, dbTypeStr);
Graph requestedProperties = null;
boolean modelExists = idbConn.containsModel(graphID);

View file

@ -244,6 +244,9 @@ public class JenaDataSourceSetupBase extends JenaBaseDaoCon {
cpds.setMaxIdleTimeExcessConnections(300);
cpds.setAcquireIncrement(5);
cpds.setNumHelperThreads(6);
cpds.setTestConnectionOnCheckout(DEFAULT_TESTONBORROW);
cpds.setTestConnectionOnCheckin(DEFAULT_TESTONRETURN);
cpds.setPreferredTestQuery(getValidationQuery(ctx));
return cpds;
}