use of org.jdbcdslog.JdbcDsLogRuntimeException in project invesdwin-context-persistence by subes.
the class ConfiguredCPDataSource method createDelegate.
@Override
protected DataSource createDelegate() {
final ComboPooledDataSource ds = new ComboPooledDataSource();
try {
ds.setDriverClass(context.getConnectionDriver());
} catch (final PropertyVetoException e1) {
throw Err.process(e1);
}
ds.setJdbcUrl(context.getConnectionUrl());
ds.setUser(context.getConnectionUser());
ds.setPassword(context.getConnectionPassword());
ds.setMaxStatements(5000);
ds.setMaxStatementsPerConnection(50);
// fix apparent deadlocks
ds.setStatementCacheNumDeferredCloseThreads(1);
ds.setMaxPoolSize(100);
ds.setMinPoolSize(1);
ds.setMaxIdleTime(new Duration(1, FTimeUnit.MINUTES).intValue(FTimeUnit.SECONDS));
ds.setTestConnectionOnCheckout(true);
ds.setAutoCommitOnClose(true);
Assertions.assertThat(this.closeableDs).isNull();
this.closeableDs = ds;
if (logging) {
try {
final ConnectionPoolDataSourceProxy proxy = new ConnectionPoolDataSourceProxy();
proxy.setTargetDSDirect(ds);
return proxy;
} catch (final JdbcDsLogRuntimeException e) {
throw new RuntimeException(e);
}
} else {
return ds;
}
}
Aggregations