use of org.apache.tomcat.jdbc.pool.PoolConfiguration in project tomcat by apache.
the class TestSizePreservation method initSimplePoolProperties.
private void initSimplePoolProperties() {
PoolConfiguration p = new DefaultProperties();
ds = new org.apache.tomcat.jdbc.pool.DataSource();
ds.setPoolProperties(p);
ds.getPoolProperties().setDriverClassName(Driver.class.getName());
ds.getPoolProperties().setUrl(Driver.url);
ds.getPoolProperties().setFairQueue(true);
ds.getPoolProperties().setJmxEnabled(false);
ds.getPoolProperties().setTestWhileIdle(true);
ds.getPoolProperties().setTestOnBorrow(false);
ds.getPoolProperties().setTestOnReturn(false);
ds.getPoolProperties().setValidationInterval(30000);
ds.getPoolProperties().setTimeBetweenEvictionRunsMillis(30000);
ds.getPoolProperties().setInitialSize(100);
ds.getPoolProperties().setMaxActive(100);
ds.getPoolProperties().setMinIdle(0);
ds.getPoolProperties().setMaxIdle(0);
ds.getPoolProperties().setMaxWait(10000);
ds.getPoolProperties().setRemoveAbandonedTimeout(10);
ds.getPoolProperties().setMinEvictableIdleTimeMillis(10000);
ds.getPoolProperties().setLogAbandoned(false);
ds.getPoolProperties().setRemoveAbandoned(false);
ds.getPoolProperties().setUseLock(true);
}
use of org.apache.tomcat.jdbc.pool.PoolConfiguration in project sling by apache.
the class DataSourceFactory method createPoolConfig.
private PoolConfiguration createPoolConfig(Map<String, ?> config) {
Properties props = new Properties();
//Copy the other properties first
Map<String, String> otherProps = PropertiesUtil.toMap(config.get(PROP_DATASOURCE_SVC_PROPS), new String[0]);
for (Map.Entry<String, String> e : otherProps.entrySet()) {
set(e.getKey(), e.getValue(), props);
}
props.setProperty(org.apache.tomcat.jdbc.pool.DataSourceFactory.OBJECT_NAME, name);
for (String propName : DummyDataSourceFactory.getPropertyNames()) {
String value = PropertiesUtil.toString(config.get(propName), null);
set(propName, value, props);
}
//Specify the DataSource such that connection creation logic is handled
//by us where we take care of OSGi env
PoolConfiguration poolProperties = org.apache.tomcat.jdbc.pool.DataSourceFactory.parsePoolProperties(props);
poolProperties.setDataSource(createDriverDataSource(poolProperties));
return poolProperties;
}
use of org.apache.tomcat.jdbc.pool.PoolConfiguration in project tomee by apache.
the class TomEEDataSourceCreator method pool.
@Override
public CommonDataSource pool(final String name, final String driver, final Properties properties) {
final PoolConfiguration config = build(TomEEPoolProperties.class, createProperties(name, properties));
final TomEEDataSource ds = new TomEEDataSource(config, name);
recipes.put(ds, recipes.remove(config));
return ds;
}
use of org.apache.tomcat.jdbc.pool.PoolConfiguration in project tomee by apache.
the class TomEEDataSourceCreator method pool.
@Override
public DataSource pool(final String name, final DataSource ds, final Properties properties) {
final PoolConfiguration config = build(TomEEPoolProperties.class, createProperties(name, properties));
config.setDataSource(ds);
final ConnectionPool pool;
try {
pool = new ConnectionPool(config);
} catch (final SQLException e) {
throw new IllegalStateException(e);
}
final TomEEDataSource dataSource = new TomEEDataSource(config, pool, name);
// transfer unset props for correct logging
recipes.put(dataSource, recipes.remove(config));
return dataSource;
}
Aggregations