当前位置: 首页>>代码示例>>Java>>正文


Java JedisConnectionFactory.setPoolConfig方法代码示例

本文整理汇总了Java中org.springframework.data.redis.connection.jedis.JedisConnectionFactory.setPoolConfig方法的典型用法代码示例。如果您正苦于以下问题:Java JedisConnectionFactory.setPoolConfig方法的具体用法?Java JedisConnectionFactory.setPoolConfig怎么用?Java JedisConnectionFactory.setPoolConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.data.redis.connection.jedis.JedisConnectionFactory的用法示例。


在下文中一共展示了JedisConnectionFactory.setPoolConfig方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: jedisConnConfig

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //导入方法依赖的package包/类
private void jedisConnConfig(final JedisConnectionFactory jedisConnectionFactory) {
    JedisPoolConfig poolConfig = new JedisPoolConfig();
    try {
        poolConfig.setMaxTotal(Integer.parseInt(REDIS_MAXTOTAL.getValue()));
        poolConfig.setMaxIdle(Integer.parseInt(REDIS_MAXIDLE.getValue()));
        poolConfig.setBlockWhenExhausted(true);
        if (!"".equals(REDIS_PASSWORD.getValue())) {
            jedisConnectionFactory.setPassword(REDIS_PASSWORD.getValue());
        }
        if (!"".equals(REDIS_DATABASE.getValue())) {
            jedisConnectionFactory.setDatabase(Integer.parseInt(REDIS_DATABASE.getValue()));
        }
        jedisConnectionFactory.setPoolConfig(poolConfig);
        jedisConnectionFactory.setUsePool(true);
        jedisConnectionFactory.setTimeout(Integer.parseInt(REDIS_TIMEOUT.getValue()));
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
}
 
开发者ID:globocom,项目名称:groot,代码行数:20,代码来源:RedisConfiguration.java

示例2: redisConnectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //导入方法依赖的package包/类
@Bean
public RedisConnectionFactory redisConnectionFactory() {
    String default_host = "localhost";
    int port = 6379;
    String host = null;
    { // setup the host using the env vars
        host = System.getenv().get(SELDON_CLUSTER_MANAGER_REDIS_HOST_KEY);
        if (host == null) {
            logger.error(String.format("FAILED to find env var [%s]", SELDON_CLUSTER_MANAGER_REDIS_HOST_KEY));
            host = default_host;
        }
    }

    logger.info(String.format("setting up connection factory, host[%s] port[%d]", host, port));
    JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
    jedisConnectionFactory.setHostName(host);
    jedisConnectionFactory.setPort(port);
    jedisConnectionFactory.setPassword("");
    jedisConnectionFactory.setUsePool(true);
    jedisConnectionFactory.setPoolConfig(new JedisPoolConfig());
    return jedisConnectionFactory;
}
 
开发者ID:SeldonIO,项目名称:seldon-core,代码行数:23,代码来源:RedisConfig.java

示例3: jedisConnectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //导入方法依赖的package包/类
@Bean
JedisConnectionFactory jedisConnectionFactory() {
    JedisConnectionFactory factory = new JedisConnectionFactory();
    factory.setHostName(redisHost);
    factory.setPort(redisPort);
    factory.setUsePool(true);
    if(StringUtils.isNotBlank(password)) {
    	factory.setPassword(password);
    }
    JedisPoolConfig config = new JedisPoolConfig();
    if(maxIdle!=null) {
    	config.setMaxIdle(maxIdle);
    }
    factory.setPoolConfig(config);
    return factory;
}
 
开发者ID:panguixiang,项目名称:my-spring-cache-redis,代码行数:17,代码来源:SpringConfig.java

示例4: createJedisConnectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //导入方法依赖的package包/类
/**
 * 建立
 * 
 * i=0, port(6379)
 * 
 * i=1, port(6379)+i=6380
 * 
 * @param i
 * @param jedisPoolConfig
 * @return
 */
protected JedisConnectionFactory createJedisConnectionFactory(int i, JedisPoolConfig jedisPoolConfig)
		throws Exception {
	JedisConnectionFactory result = new JedisConnectionFactory();
	String hostName = extendedProperties.getString(HOSTNAME, DEFAULT_HOSTNAME);
	//
	int port = extendedProperties.getInt(PORT, DEFAULT_PORT);
	port += i;
	LOGGER.info("redis[" + i + "]: " + hostName + ":" + port);
	//
	result.setHostName(hostName);
	result.setPort(port);
	//
	result.setPassword(extendedProperties.getString(PASSWORD, DEFAULT_PASSWORD));
	//
	result.setPoolConfig(jedisPoolConfig);
	result.afterPropertiesSet();
	//
	return result;
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:31,代码来源:JedisConnectionFactoryFactorySupporter.java

示例5: connectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //导入方法依赖的package包/类
/**
     *redis 单例
     * @param poolConfig
     * @return
     */
    @Bean(name = "connectionFactory")
    public RedisConnectionFactory connectionFactory(
            JedisPoolConfig poolConfig){
        JedisConnectionFactory jcf=new JedisConnectionFactory();
        jcf.setHostName(this.host);
        jcf.setPort(this.port);
        jcf.setTimeout(timeout);
//        jcf.setPassword(this.password);
        jcf.setPoolConfig(poolConfig);
        return jcf;
    }
 
开发者ID:tomoncle,项目名称:JavaStudy,代码行数:17,代码来源:RedisBeans.java

示例6: getConnectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //导入方法依赖的package包/类
@Bean
@ConfigurationProperties(prefix = "spring.redis")
public JedisConnectionFactory getConnectionFactory() {
    JedisConnectionFactory factory = new JedisConnectionFactory();
    JedisPoolConfig config = getRedisConfig();
    factory.setPoolConfig(config);
    logger.info("JedisConnectionFactory bean init success.");
    return factory;
}
 
开发者ID:1991wangliang,项目名称:tx-lcn,代码行数:10,代码来源:RedisConfig.java

示例7: getConnectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //导入方法依赖的package包/类
@Bean
@ConfigurationProperties(prefix="spring.redis")
public JedisConnectionFactory getConnectionFactory(){
    JedisConnectionFactory factory = new JedisConnectionFactory();
    JedisPoolConfig config = getRedisConfig();
    factory.setPoolConfig(config);
    logger.info("JedisConnectionFactory bean init success.");
    return factory;
}
 
开发者ID:Nbsaw,项目名称:miaohu,代码行数:10,代码来源:RedisConfig.java

示例8: getConnectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //导入方法依赖的package包/类
@Bean  
@ConfigurationProperties(prefix="spring.redis")  
public JedisConnectionFactory getConnectionFactory(){  
    JedisConnectionFactory factory = new JedisConnectionFactory();  
    JedisPoolConfig config = getRedisConfig();  
    factory.setPoolConfig(config);  
    System.out.println("JedisConnectionFactory bean init success.");  
    return factory;  
}
 
开发者ID:lonelyshine,项目名称:xcx-specialty,代码行数:10,代码来源:RedisConfiguration.java

示例9: connectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //导入方法依赖的package包/类
@Bean
public JedisConnectionFactory connectionFactory(JedisPoolConfig jedisPoolConfig) {
    JedisConnectionFactory connection = new JedisConnectionFactory();
    connection.setHostName(getPropertyFormEnv("redis.host"));
    connection.setPort(getIntPropertyFormEnv("redis.port"));
    connection.setTimeout(getIntPropertyFormEnv("redis.timeout"));
    connection.setDatabase(getIntPropertyFormEnv("redis.database"));
    connection.setPoolConfig(jedisPoolConfig);
    return connection;
}
 
开发者ID:izhangzhihao,项目名称:SpringMVCWithJavaConfig,代码行数:11,代码来源:RedisConfig.java

示例10: securityRedisConnectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //导入方法依赖的package包/类
@Bean
  @OnMissingBean(JedisConnectionFactory.class)
  public JedisConnectionFactory securityRedisConnectionFactory() throws Exception {
int port = securityConfig.getRedis().getPort();
String hostName = securityConfig.getRedis().getHostName();
JedisConnectionFactory jf = new JedisConnectionFactory();
jf.setPort(port);
jf.setHostName(hostName);
SpringUtils.newBeanWrapper(jf).setPropertyValues(securityConfig.getRedis());
if(securityConfig.getRedis().getPool()!=null){
	jf.setPoolConfig(securityConfig.getRedis().getPool());
}
return jf;
  }
 
开发者ID:wayshall,项目名称:onetwo,代码行数:15,代码来源:RedisContextConfig.java

示例11: jfishRedisConnectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //导入方法依赖的package包/类
@Bean
   @ConditionalOnMissingBean(name=BEAN_REDISCONNECTIONFACTORY)
@ConditionalOnProperty(name=JFishRedisProperties.ENABLED_KEY, havingValue="true")
   public JedisConnectionFactory jfishRedisConnectionFactory() throws Exception {
	JedisConnectionFactory jf = new JedisConnectionFactory();
	CopyUtils.copy(jf, redisProperties);
	if(redisProperties.getPool()!=null){
		jf.setPoolConfig(redisProperties.getPool());
	}
	return jf;
   }
 
开发者ID:wayshall,项目名称:onetwo,代码行数:12,代码来源:RedisConfiguration.java

示例12: configurePool

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:10,代码来源:RedisConnectionFactoryConfigurer.java


注:本文中的org.springframework.data.redis.connection.jedis.JedisConnectionFactory.setPoolConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。