org.springframework.cloud.service.PooledServiceConnectorConfig Java Examples

The following examples show how to use org.springframework.cloud.service.PooledServiceConnectorConfig. 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: DataSourceCloudConfig.java    From spring-cloud-dataflow-server-cloudfoundry with Apache License 2.0 5 votes vote down vote up
@Bean
public DataSource scdfCloudDataSource(
		CloudFoundryServerConfigurationProperties cloudFoundryServerConfigurationProperties) {
	PooledServiceConnectorConfig.PoolConfig poolConfig = new PooledServiceConnectorConfig.PoolConfig(
			cloudFoundryServerConfigurationProperties.getMaxPoolSize(),
			cloudFoundryServerConfigurationProperties.getMaxWaitTime());
	DataSourceConfig dbConfig = new DataSourceConfig(poolConfig, null);
	return connectionFactory().dataSource(dbConfig);
}
 
Example #2
Source File: RedisJedisClientConfigurer.java    From spring-cloud-connectors with Apache License 2.0 5 votes vote down vote up
private void configurePool(JedisClientConfigurationBuilder clientConfiguration, PooledServiceConnectorConfig config) {
	if (config.getPoolConfig() != null) {
		JedisPoolConfig poolConfig = new JedisPoolConfig();
		BeanWrapper target = new BeanWrapperImpl(poolConfig);
		BeanWrapper source = new BeanWrapperImpl(config.getPoolConfig());
		Util.setCorrespondingProperties(target, source);

		clientConfiguration.usePooling().poolConfig(poolConfig);
	}
}
 
Example #3
Source File: RedisLettuceClientConfigurer.java    From spring-cloud-connectors with Apache License 2.0 5 votes vote down vote up
private void configurePool(LettuceClientConfigurationBuilder clientConfiguration, PooledServiceConnectorConfig config) {
	if (config.getPoolConfig() != null) {
		GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
		BeanWrapper target = new BeanWrapperImpl(poolConfig);
		BeanWrapper source = new BeanWrapperImpl(config.getPoolConfig());
		Util.setCorrespondingProperties(target, source);

		((LettucePoolingClientConfigurationBuilder) clientConfiguration).poolConfig(poolConfig);
	}
}
 
Example #4
Source File: SpringData1RedisConnectionFactoryConfigurer.java    From spring-cloud-connectors with Apache License 2.0 5 votes vote down vote up
private void configurePool(JedisConnectionFactory connectionFactory, PooledServiceConnectorConfig config) {
    if (config.getPoolConfig() != null) {
        JedisPoolConfig poolConfig = new JedisPoolConfig();
        BeanWrapper target = new BeanWrapperImpl(poolConfig);
        BeanWrapper source = new BeanWrapperImpl(config.getPoolConfig());
        Util.setCorrespondingProperties(target, source);
        connectionFactory.setPoolConfig(poolConfig);
    }
}
 
Example #5
Source File: RedisJedisClientConfigurer.java    From spring-cloud-connectors with Apache License 2.0 4 votes vote down vote up
public JedisClientConfigurationBuilder configure(JedisClientConfigurationBuilder clientConfiguration, PooledServiceConnectorConfig config) {
	if (config != null) {
		configurePool(clientConfiguration, config);
	}
	return clientConfiguration;
}
 
Example #6
Source File: RedisLettuceClientConfigurer.java    From spring-cloud-connectors with Apache License 2.0 4 votes vote down vote up
public LettuceClientConfigurationBuilder configure(LettuceClientConfigurationBuilder clientConfiguration, PooledServiceConnectorConfig config) {
	if (config != null) {
		configurePool(clientConfiguration, config);
	}
	return clientConfiguration;
}
 
Example #7
Source File: SpringData1RedisConnectionFactoryConfigurer.java    From spring-cloud-connectors with Apache License 2.0 4 votes vote down vote up
public JedisConnectionFactory configure(JedisConnectionFactory connectionFactory, PooledServiceConnectorConfig config) {
    if (config != null) {
        configurePool(connectionFactory, config);
    }
    return connectionFactory;
}
 
Example #8
Source File: ServiceConnectionFactory.java    From spring-cloud-connectors with Apache License 2.0 4 votes vote down vote up
RedisConnectionFactory redisConnectionFactory(String serviceId,
PooledServiceConnectorConfig redisConnectionFactoryConfig);
 
Example #9
Source File: RedisConnectionFactoryJavaConfigTest.java    From spring-cloud-connectors with Apache License 2.0 4 votes vote down vote up
@Bean
public RedisConnectionFactory pool20Wait200() {
	PoolConfig poolConfig = new PoolConfig(20, 200);
	PooledServiceConnectorConfig serviceConfig = new PooledServiceConnectorConfig(poolConfig);
	return connectionFactory().redisConnectionFactory("my-service", serviceConfig);
}
 
Example #10
Source File: RedisConnectionFactoryJavaConfigTest.java    From spring-cloud-connectors with Apache License 2.0 4 votes vote down vote up
@Bean
public RedisConnectionFactory pool5_30Wait3000() {
	PoolConfig poolConfig = new PoolConfig(5, 30, 3000);
	PooledServiceConnectorConfig serviceConfig = new RedisConnectionFactoryConfig(poolConfig);
	return connectionFactory().redisConnectionFactory("my-service", serviceConfig);
}
 
Example #11
Source File: CloudServiceConnectionFactory.java    From spring-cloud-connectors with Apache License 2.0 2 votes vote down vote up
/**
 * Get the {@link RedisConnectionFactory} object associated with the only Redis service bound to the app.
 *
 * This is equivalent to the {@code <cloud:redis-connection-factory/>} element
 *
 * @return redis connection factory
 * @throws CloudException
 *             if there are either 0 or more than 1 redis services.
 */
@Override
public RedisConnectionFactory redisConnectionFactory() {
	return redisConnectionFactory((PooledServiceConnectorConfig) null);
}
 
Example #12
Source File: CloudServiceConnectionFactory.java    From spring-cloud-connectors with Apache License 2.0 2 votes vote down vote up
/**
 * Get the {@link RedisConnectionFactory} object associated with the only Redis service bound to the app
 * configured as specified.
 *
 * This is equivalent to the {@code <cloud:redis-connection-factory service-id="serviceId">} element
 * with a nested {@code <cloud:pool>} element.
 *
 * @param redisConnectionFactoryConfig
 *            configuration for the {@link RedisConnectionFactory} created
 * @return redis connection factory
 * @throws CloudException
 *             if there are either 0 or more than 1 redis services.
 */
@Override
public RedisConnectionFactory redisConnectionFactory(PooledServiceConnectorConfig redisConnectionFactoryConfig) {
	return cloud.getSingletonServiceConnector(RedisConnectionFactory.class, redisConnectionFactoryConfig);
}
 
Example #13
Source File: CloudServiceConnectionFactory.java    From spring-cloud-connectors with Apache License 2.0 2 votes vote down vote up
/**
 * Get the {@link RedisConnectionFactory} object for the specified Redis service configured as specified.
 *
 * This is equivalent to the {@code <cloud:redis-connection-factory service-id="serviceId">} element
 * with a nested {@code <cloud:pool>} element.
 *
 * @param serviceId
 *            the name of the service
 * @param redisConnectionFactoryConfig
 *            configuration for the {@link RedisConnectionFactory} created
 * @return redis connection factory
 * @throws CloudException
 *             if the specified service doesn't exist
 */
@Override
public RedisConnectionFactory redisConnectionFactory(String serviceId,
													 PooledServiceConnectorConfig redisConnectionFactoryConfig) {
	return cloud.getServiceConnector(serviceId, RedisConnectionFactory.class, redisConnectionFactoryConfig);
}
 
Example #14
Source File: ServiceConnectionFactory.java    From spring-cloud-connectors with Apache License 2.0 votes vote down vote up
RedisConnectionFactory redisConnectionFactory(PooledServiceConnectorConfig redisConnectionFactoryConfig);