com.vladmihalcea.flexypool.adaptor.HikariCPPoolAdapter Java Examples

The following examples show how to use com.vladmihalcea.flexypool.adaptor.HikariCPPoolAdapter. 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: FlexyPoolTestConfiguration.java    From high-performance-java-persistence with Apache License 2.0 6 votes vote down vote up
@Override
public DataSource actualDataSource() {
    final HikariDataSource dataSource = (HikariDataSource) super.actualDataSource();

    com.vladmihalcea.flexypool.config.Configuration<HikariDataSource> configuration =
        new com.vladmihalcea.flexypool.config.Configuration.Builder<>(
            "flexy-pool-test",
            dataSource,
            HikariCPPoolAdapter.FACTORY
        )
    .build();

    return new FlexyPoolDataSource<>(
        configuration
    );
}
 
Example #2
Source File: FlexyPoolConfiguration.java    From flexy-pool with Apache License 2.0 5 votes vote down vote up
@Bean
public Configuration<HikariDataSource> configuration() {
    return new Configuration.Builder<HikariDataSource>(
            uniqueId,
            poolingDataSource,
            HikariCPPoolAdapter.FACTORY
    ).build();
}
 
Example #3
Source File: FlexyPoolWrapper.java    From hammock with Apache License 2.0 5 votes vote down vote up
private Configuration<HikariDataSource> createConfiguration(String name, Config config, HikariDataSource dataSource) {
    String uniqueId = config.getOptionalValue(format(UNIQUE_ID_PROPERTY_FORMAT, name), String.class).orElse(name);
    Configuration.Builder<HikariDataSource> builder = new Configuration.Builder<>(uniqueId, dataSource, HikariCPPoolAdapter.FACTORY);
    if(metricsFactoryInstance.isResolvable()) {
        MetricsFactory metricsFactory = metricsFactoryInstance.get();
        builder.setMetricsFactory(metricsFactory);
    }
    return builder.build();
}
 
Example #4
Source File: FlexyPoolConfiguration.java    From spring-boot-data-source-decorator with Apache License 2.0 4 votes vote down vote up
@Bean
public FlexyPoolDataSourceDecorator flexyPoolDataSourceDecorator() {
    return new FlexyPoolDataSourceDecorator(
            mergeFactories(connectionAcquiringStrategyFactories, dataSourceDecoratorProperties.getFlexyPool()),
            HikariCPPoolAdapter.FACTORY, HikariDataSource.class);
}