當前位置: 首頁>>代碼示例>>Java>>正文


Java JedisConnectionFactory.setTimeout方法代碼示例

本文整理匯總了Java中org.springframework.data.redis.connection.jedis.JedisConnectionFactory.setTimeout方法的典型用法代碼示例。如果您正苦於以下問題:Java JedisConnectionFactory.setTimeout方法的具體用法?Java JedisConnectionFactory.setTimeout怎麽用?Java JedisConnectionFactory.setTimeout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.data.redis.connection.jedis.JedisConnectionFactory的用法示例。


在下文中一共展示了JedisConnectionFactory.setTimeout方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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
@RefreshScope
public RedisConnectionFactory redisConnectionFactory() {
    final RedisTicketRegistryProperties redis = casProperties.getTicket().getRegistry().getRedis();
    final JedisPoolConfig poolConfig = redis.getPool() != null ? jedisPoolConfig() : new JedisPoolConfig();

    final JedisConnectionFactory factory = new JedisConnectionFactory(poolConfig);
    factory.setHostName(redis.getHost());
    factory.setPort(redis.getPort());
    if (redis.getPassword() != null) {
        factory.setPassword(redis.getPassword());
    }
    factory.setDatabase(redis.getDatabase());
    if (redis.getTimeout() > 0) {
        factory.setTimeout(redis.getTimeout());
    }
    return factory;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:19,代碼來源:RedisTicketRegistryConfiguration.java

示例3: afterPropertiesSet

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //導入方法依賴的package包/類
@Override
public void afterPropertiesSet() throws Exception {
    int redisCount = Integer.parseInt(RedisProperties.getPropertie("redis.count").toString());
    factories = new ArrayList<JedisConnectionFactory>(redisCount);
    for (int i = 0; i < redisCount; i++) {
        int dbSize = 1;
        Object dbSizeObj = RedisProperties.getPropertie("redis.db.size" + i);
        if (dbSizeObj != null) {
            dbSize = Integer.valueOf(dbSizeObj.toString());
        }
        for (int j = 0; j < dbSize; j++) {
            JedisConnectionFactory factory = new JedisConnectionFactory(sentinelConfig,poolConfig);
            factory.setHostName(RedisProperties.getPropertie("redis.host" + i).toString());
            factory.setPort(Integer.parseInt(RedisProperties.getPropertie("redis.port" + i).toString()));
            factory.setPassword(RedisProperties.getPropertie("reids.passwd" + i).toString());
            factory.setTimeout(Integer.parseInt(RedisProperties.getPropertie("redis.timeout").toString()));
            factory.setDatabase(j);
            // 執行必要方法
            factory.afterPropertiesSet();
            factories.add(factory);
        }
    }
}
 
開發者ID:Fourwenwen,項目名稱:consistent-hashing-redis,代碼行數:24,代碼來源:HwRedisConnectionFactory.java

示例4: 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

示例5: sentinelConnectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //導入方法依賴的package包/類
/**
     *redis 主從
     * @return
     */
    @Bean(name="sentinelConnectionFactory")
    public RedisConnectionFactory sentinelConnectionFactory(
            JedisPoolConfig poolConfig,
            RedisSentinelConfiguration sentinelConfig){
        if(sentinelConfig!=null){
            JedisConnectionFactory jcf=new JedisConnectionFactory(sentinelConfig,poolConfig);
            jcf.setHostName(this.host);
            jcf.setPort(this.port);
            jcf.setTimeout(timeout);
//            jcf.setPassword(this.password);
            return jcf;
        }
        return connectionFactory(poolConfig);
    }
 
開發者ID:tomoncle,項目名稱:JavaStudy,代碼行數:19,代碼來源:RedisBeans.java

示例6: createJedisConnectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //導入方法依賴的package包/類
private RedisConnectionFactory createJedisConnectionFactory(final LocalRedisProperties redisProperties) {
    JedisPoolConfig poolConfig = new JedisPoolConfig();
    poolConfig.setMaxTotal(redisProperties.getMinActive());
    poolConfig.setMinIdle(redisProperties.getMaxActive());
    poolConfig.setMaxWaitMillis(redisProperties.getMaxWaitTime());
    poolConfig.setTestOnBorrow(false);

    JedisConnectionFactory connFactory = new JedisConnectionFactory(poolConfig);
    connFactory.setUsePool(false);
    connFactory.setTimeout(redisProperties.getSoTimeout());
    connFactory.setHostName(redisProperties.getRedisHost());
    connFactory.setPort(redisProperties.getRedisPort());
    return connFactory;
}
 
開發者ID:eclipse,項目名稱:keti,代碼行數:15,代碼來源:LocalRedisConnectionFactoryConfig.java

示例7: redisConnectionFactory

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //導入方法依賴的package包/類
@Bean
public JedisConnectionFactory redisConnectionFactory() {
	JedisConnectionFactory factory = new JedisConnectionFactory();
	factory.setHostName(host);
	factory.setPort(port);
	factory.setTimeout(timeout); // 設置連接超時時間
	return factory;
}
 
開發者ID:Myazure,項目名稱:weixin_component,代碼行數:9,代碼來源:RedisConfiguration.java

示例8: applyProperties

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //導入方法依賴的package包/類
protected final JedisConnectionFactory applyProperties(
		JedisConnectionFactory factory) {
	factory.setHostName(this.properties.getHost());
	factory.setPort(this.properties.getPort());
	if (this.properties.getPassword() != null) {
		factory.setPassword(this.properties.getPassword());
	}
	factory.setDatabase(this.properties.getDatabase());
	if (this.properties.getTimeout() > 0) {
		factory.setTimeout(this.properties.getTimeout());
	}
	return factory;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:14,代碼來源:RedisAutoConfiguration.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: applyProperties

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //導入方法依賴的package包/類
protected final JedisConnectionFactory applyProperties(
		JedisConnectionFactory factory) {
	configureConnection(factory);
	if (this.properties.isSsl()) {
		factory.setUseSsl(true);
	}
	factory.setDatabase(this.properties.getDatabase());
	if (this.properties.getTimeout() > 0) {
		factory.setTimeout(this.properties.getTimeout());
	}
	return factory;
}
 
開發者ID:easycodebox,項目名稱:easycode,代碼行數:13,代碼來源:ShiroRedisAutoConfiguration.java

示例11: InvoiceServiceImpl

import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; //導入方法依賴的package包/類
@Autowired
public InvoiceServiceImpl( JedisConnectionFactory connectionFactory )
{
    connectionFactory.setTimeout( 10000 );
    jedisPool = new JedisPool( connectionFactory.getPoolConfig(), connectionFactory.getHostName() );
}
 
開發者ID:ClouDesire,項目名稱:janine,代碼行數:7,代碼來源:InvoiceServiceImpl.java


注:本文中的org.springframework.data.redis.connection.jedis.JedisConnectionFactory.setTimeout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。