org.vibur.dbcp.ViburDBCPDataSource Java Examples

The following examples show how to use org.vibur.dbcp.ViburDBCPDataSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataSourceIT.java    From apm-agent-java with Apache License 2.0 5 votes vote down vote up
private static DataSource getViburDataSource() {
    ViburDBCPDataSource ds = new ViburDBCPDataSource();
    ds.setJdbcUrl(URL);
    ds.setUsername("");
    ds.setPassword("");
    ds.start();
    return ds;
}
 
Example #2
Source File: JDBCDriverWithPoolTest.java    From testcontainers-java with MIT License 5 votes vote down vote up
private static DataSource getViburDataSourceWithDriverClassName() {
    ViburDBCPDataSource ds = new ViburDBCPDataSource();

    ds.setJdbcUrl(URL + ";TEST=VIBUR_WITH_CLASSNAME");
    ds.setUsername("any");  // Recent versions of Vibur require a username, even though it will not be used
    ds.setPassword("");
    ds.setPoolInitialSize(3);
    ds.setPoolMaxSize(10);
    ds.setTestConnectionQuery("SELECT 1");
    ds.setDriverClassName(ContainerDatabaseDriver.class.getName());

    ds.start();

    return ds;
}
 
Example #3
Source File: JDBCDriverWithPoolTest.java    From testcontainers-java with MIT License 5 votes vote down vote up
private static DataSource getViburDataSource() {
    ViburDBCPDataSource ds = new ViburDBCPDataSource();
    ds.setJdbcUrl(URL + ";TEST=VIBUR");
    ds.setUsername("any");  // Recent versions of Vibur require a username, even though it will not be used
    ds.setPassword("");
    ds.setPoolInitialSize(3);
    ds.setPoolMaxSize(10);
    ds.setTestConnectionQuery("SELECT 1");

    ds.start();

    return ds;
}
 
Example #4
Source File: PoolOperations.java    From vibur-dbcp with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates the PoolOperations facade.
 *
 * @param dataSource the Vibur dataSource on which we will operate
 * @param connectionFactory the Vibur connection factory
 * @param poolService the Vibur pool service
 */
public PoolOperations(ViburDBCPDataSource dataSource, ViburObjectFactory connectionFactory, PoolService<ConnHolder> poolService) {
    this.dataSource = dataSource;
    this.connectionTimeoutInNanos = MILLISECONDS.toNanos(dataSource.getConnectionTimeoutInMs());
    this.connectionFactory = connectionFactory;
    this.poolService = poolService;
    this.criticalSQLStates = new HashSet<>(Arrays.asList(
            whitespaces.matcher(dataSource.getCriticalSQLStates()).replaceAll("").split(",")));
}
 
Example #5
Source File: ViburDBCPGetConnectionTestPerf.java    From vibur-dbcp with Apache License 2.0 5 votes vote down vote up
private Worker(ViburDBCPDataSource ds, AtomicInteger errors, long millis,
               CountDownLatch readySignal, CountDownLatch startSignal, CountDownLatch doneSignal) {
    this.ds = ds;
    this.errors = errors;
    this.millis = millis;
    this.startSignal = startSignal;
    this.readySignal = readySignal;
    this.doneSignal = doneSignal;
}
 
Example #6
Source File: ViburDBCPGetConnectionTestPerf.java    From vibur-dbcp with Apache License 2.0 5 votes vote down vote up
private static ViburDBCPDataSource createDataSource() {
    ViburDBCPDataSource ds = new ViburDBCPDataSource();
    ds.setJdbcUrl("jdbc:hsqldb:mem:sakila;shutdown=false");
    ds.setUsername("sa");
    ds.setPassword("");

    ds.setPoolInitialSize(INITIAL_SIZE);
    ds.setPoolMaxSize(MAX_SIZE);
    ds.setConnectionTimeoutInMs(TIMEOUT_MS);
    ds.setPoolFair(FAIR);
    return ds;
}
 
Example #7
Source File: FlexyPoolConfiguration.java    From flexy-pool with Apache License 2.0 5 votes vote down vote up
@Bean
public Configuration<ViburDBCPDataSource> configuration() {
    return new Configuration.Builder<ViburDBCPDataSource>(
            uniqueId,
            poolingDataSource,
            ViburDBCPPoolAdapter.FACTORY
    ).build();
}
 
Example #8
Source File: FlexyPoolConfiguration.java    From flexy-pool with Apache License 2.0 5 votes vote down vote up
@Bean(initMethod = "start", destroyMethod = "stop")
public FlexyPoolDataSource dataSource() {
    Configuration<ViburDBCPDataSource> configuration = configuration();
    return new FlexyPoolDataSource<ViburDBCPDataSource>(configuration,
            new RetryConnectionAcquiringStrategy.Factory(2)
    );
}
 
Example #9
Source File: ViburDBCPPoolAdapter.java    From flexy-pool with Apache License 2.0 4 votes vote down vote up
@Override
public PoolAdapter<ViburDBCPDataSource> newInstance(
        ConfigurationProperties<ViburDBCPDataSource, Metrics, PoolAdapter<ViburDBCPDataSource>> configurationProperties) {
    return new ViburDBCPPoolAdapter(configurationProperties);
}
 
Example #10
Source File: ViburDBCPPoolAdapter.java    From flexy-pool with Apache License 2.0 2 votes vote down vote up
/**
 * Init constructor
 * @param configurationProperties configuration properties
 */
public ViburDBCPPoolAdapter(ConfigurationProperties<ViburDBCPDataSource, Metrics, PoolAdapter<ViburDBCPDataSource>> configurationProperties) {
    super(configurationProperties);
}