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


Java JedisPoolConfig.setMaxIdle方法代碼示例

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


在下文中一共展示了JedisPoolConfig.setMaxIdle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getInstance

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
public static JedisConnector_Persistence getInstance() {
	if (instance == null) {
		instance = new JedisConnector_Persistence();
		JedisPoolConfig config = new JedisPoolConfig();
		config.setMaxTotal(Configs.getIntValue("x7.redis.max"));
		config.setMaxIdle(Configs.getIntValue("x7.redis.idle"));
		config.setJmxEnabled(true);
		config.setJmxNamePrefix("redis-persistence");
		config.setTestOnBorrow(true);

		System.out.println("x7.redis.ip.persistence = " + Configs.getString("x7.redis.ip.persistence"));
		System.out.println("x7.redis.port.persistence = " + Configs.getString("x7.redis.port.persistence"));

		pool = new JedisPool(config, Configs.getString("x7.redis.ip.persistence"),
				Configs.getIntValue("x7.redis.port.persistence")); // 6379
	}
	return instance;
}
 
開發者ID:x7-framework,項目名稱:x7,代碼行數:19,代碼來源:JedisConnector_Persistence.java

示例2: getRedisCluster

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
@Bean
public JedisCluster getRedisCluster(){
    Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
    jedisClusterNode.add(new HostAndPort(environment.getProperty("redis.cluster.nodes1"), Integer.parseInt(environment.getProperty("redis.cluster.port1"))));
    jedisClusterNode.add(new HostAndPort(environment.getProperty("redis.cluster.nodes2"), Integer.parseInt(environment.getProperty("redis.cluster.port2"))));
    jedisClusterNode.add(new HostAndPort(environment.getProperty("redis.cluster.nodes3"), Integer.parseInt(environment.getProperty("redis.cluster.port3"))));
    jedisClusterNode.add(new HostAndPort(environment.getProperty("redis.cluster.nodes4"), Integer.parseInt(environment.getProperty("redis.cluster.port4"))));
    jedisClusterNode.add(new HostAndPort(environment.getProperty("redis.cluster.nodes5"), Integer.parseInt(environment.getProperty("redis.cluster.port5"))));
    jedisClusterNode.add(new HostAndPort(environment.getProperty("redis.cluster.nodes6"), Integer.parseInt(environment.getProperty("redis.cluster.port6"))));
    JedisPoolConfig cfg = new JedisPoolConfig();
    cfg.setMaxTotal(Integer.parseInt(environment.getProperty("redis.cluster.config.max-total")));
    cfg.setMaxIdle(Integer.parseInt(environment.getProperty("redis.cluster.config.max-idle")));
    cfg.setMaxWaitMillis(Integer.parseInt(environment.getProperty("redis.cluster.config.max-waitmillis")));
    cfg.setTestOnBorrow(Boolean.parseBoolean(environment.getProperty("redis.cluster.config.onborrow"))); 
    JedisCluster jc = new JedisCluster(jedisClusterNode, Integer.parseInt(environment.getProperty("redis.cluster.timeout")), Integer.parseInt(environment.getProperty("redis.cluster.max-redirections")), cfg);
    return jc;
}
 
開發者ID:craware,項目名稱:webapp-tyust,代碼行數:18,代碼來源:ClusterConfig.java

示例3: initialPool

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
/**
 * 初始化Redis連接池
 */
private static void initialPool() {
	try {
		JedisPoolConfig config = new JedisPoolConfig();
		config.setMaxTotal(MAX_ACTIVE);
		config.setMaxIdle(MAX_IDLE);
		config.setMaxWaitMillis(MAX_WAIT);
		config.setTestOnBorrow(TEST_ON_BORROW);
		jedisPool = new JedisPool(config, IP, PORT, TIMEOUT);
	} catch (Exception e) {
		LOGGER.error("First create JedisPool error : " + e);
	}
}
 
開發者ID:ChangyiHuang,項目名稱:shuzheng,代碼行數:16,代碼來源:RedisUtil.java

示例4: getJedisPoolConfig

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
@Bean
public JedisPoolConfig getJedisPoolConfig(){
    JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
    jedisPoolConfig.setMaxTotal(redisProperties.getMaxTotal());
    jedisPoolConfig.setMaxIdle(redisProperties.getMaxIdle());
    jedisPoolConfig.setMinIdle(redisProperties.getMinIdle());
    jedisPoolConfig.setMaxWaitMillis(redisProperties.getMaxWaitMillis());
    return jedisPoolConfig;
}
 
開發者ID:yu199195,項目名稱:happylifeplat-transaction,代碼行數:10,代碼來源:JedisClusterConfig.java

示例5: poolConfig

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
/**
 * redis 連接池配置
 * @return
 */
@Bean
public JedisPoolConfig poolConfig(){
    JedisPoolConfig jpc=new JedisPoolConfig();
    jpc.setMaxIdle(this.configMaxIdle);
    jpc.setTestOnBorrow(this.configTestOnBorrow);
    jpc.setMaxWaitMillis(this.configMaxWaitMillis);
    jpc.setMaxTotal(this.configMaxTotal);
    return jpc;
}
 
開發者ID:tomoncle,項目名稱:JavaStudy,代碼行數:14,代碼來源:RedisBeans.java

示例6: jedisPoolConfig

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
@Bean
public JedisPoolConfig jedisPoolConfig(){
    JedisPoolConfig jpc=new JedisPoolConfig();
    jpc.setMaxIdle(this.configMaxIdle);
    jpc.setTestOnBorrow(this.configTestOnBorrow);
    jpc.setMaxWaitMillis(this.configMaxWaitMillis);
    jpc.setMaxTotal(this.configMaxTotal);
    return jpc;
}
 
開發者ID:tomoncle,項目名稱:JavaStudy,代碼行數:10,代碼來源:RedisClusterBeans.java

示例7: constructJedisPoolConfig

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
@Bean
public JedisPoolConfig constructJedisPoolConfig() {
    JedisPoolConfig config = new JedisPoolConfig();
    // 控製一個pool可分配多少個jedis實例,通過pool.getResource()來獲取;
    // 如果賦值為-1,則表示不限製;如果pool已經分配了maxActive個jedis實例,則此時pool的狀態為exhausted(耗盡)。
    config.setMaxTotal(Integer.parseInt(maxActive));
    // 控製一個pool最多有多少個狀態為idle(空閑的)的jedis實例。
    config.setMaxIdle(Integer.parseInt(maxIdle));
    // 表示當borrow(引入)一個jedis實例時,最大的等待時間,如果超過等待時間,則直接拋出JedisConnectionException;
    config.setMaxWaitMillis(Integer.parseInt(maxWait));
    config.setTestOnBorrow(true);

    return config;
}
 
開發者ID:wxiaoqi,項目名稱:ace-cache,代碼行數:15,代碼來源:RedisConfig.java

示例8: create

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
public static RedisConnection create() {
    JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
    jedisPoolConfig.setMaxTotal(50);
    jedisPoolConfig.setMaxIdle(10);
    jedisPoolConfig.setMinIdle(1);
    RedisConnection redisConnection = new RedisConnection();
    redisConnection.setIp("10.110.2.56");
    redisConnection.setPort(52981);
    redisConnection.setPwd("hhSbcpotThgWdnxJNhrzwstSP20DvYOldkjf");
    redisConnection.setClientName(Thread.currentThread().getName());
    redisConnection.setTimeOut(600);
    redisConnection.setJedisPoolConfig(jedisPoolConfig);
    return redisConnection;
}
 
開發者ID:gaochao2000,項目名稱:redis_util,代碼行數:15,代碼來源:RedisConnectionUtil.java

示例9: redisPoolFactory

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
@Bean
public JedisPool redisPoolFactory() {
    logger.info("redis: " + host + ":" + port);
    JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
    jedisPoolConfig.setMaxIdle(maxIdle);
    jedisPoolConfig.setMaxWaitMillis(maxWaitMillis);

    JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, password);
    return jedisPool;
}
 
開發者ID:ZhuXS,項目名稱:Spring-Shiro-Spark,代碼行數:11,代碼來源:RedisCacheConfig.java

示例10: getInstance

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
public static JedisConnector_Cache getInstance(){
	if (instance == null){
		instance = new JedisConnector_Cache();
		JedisPoolConfig config = new JedisPoolConfig();
		config.setMaxTotal(Configs.getIntValue("x7.redis.max"));
		config.setMaxIdle(Configs.getIntValue("x7.redis.idle"));
		config.setJmxEnabled(true);
		config.setJmxNamePrefix("redis-cahce");
		config.setTestOnBorrow(true);
		
		pool = new JedisPool( config, Configs.getString("x7.redis.ip.cache"), Configs.getIntValue("x7.redis.port.cache"));  //6379
	}
	return instance;
}
 
開發者ID:x7-framework,項目名稱:x7,代碼行數:15,代碼來源:JedisConnector_Cache.java

示例11: initRedisProvider

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
public static void initRedisProvider() {
    JedisPoolConfig poolConfig = new JedisPoolConfig();
    poolConfig.setMaxIdle(1);
    poolConfig.setMinEvictableIdleTimeMillis(60 * 1000);
    poolConfig.setMaxTotal(5);
    poolConfig.setMaxWaitMillis(30 * 1000);
    String[] servers = "127.0.0.1:6379".split(",");
    int timeout = 3000;
    String password = null;
    int database = 0;
    JedisProvider<Jedis, BinaryJedis> provider = new JedisStandaloneProvider("default", poolConfig, servers, timeout, password,
            database, null);
    JedisProviderFactory.setDefaultJedisProvider(provider);
}
 
開發者ID:warlock-china,項目名稱:azeroth,代碼行數:15,代碼來源:RedisDistributeLockTest.java

示例12: redisPoolFactory

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
@Bean
public JedisPool redisPoolFactory() {
    Logger.getLogger(getClass()).info("JedisPool注入成功!!");
    Logger.getLogger(getClass()).info("redis地址:" + host + ":" + port);
    JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
    jedisPoolConfig.setMaxIdle(maxIdle);
    jedisPoolConfig.setMaxWaitMillis(maxWaitMillis);

    JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout);

    return jedisPool;
}
 
開發者ID:ChinaLHR,項目名稱:JavaQuarkBBS,代碼行數:13,代碼來源:RedisConfig.java

示例13: initJedisPool

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
private void initJedisPool() {
    JedisPoolConfig config = new JedisPoolConfig();
    config.setMaxIdle(configuration.getInt("maxIdle"));
    config.setMinIdle(configuration.getInt("minIdle"));
    config.setMaxWaitMillis(configuration.getInt("maxWait"));
    jedisPool = new JedisPool(config, configuration.getString("host"), configuration.getInt("port"), configuration.getInt("timeout"), configuration.getString("password"));
}
 
開發者ID:Zephery,項目名稱:newblog,代碼行數:8,代碼來源:JedisUtil.java

示例14: initialPool

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
/**
 * 初始化Redis連接池
 */
private static void initialPool() {
	try {
		JedisPoolConfig config = new JedisPoolConfig();
		config.setMaxTotal(MAX_ACTIVE);
		config.setMaxIdle(MAX_IDLE);
		config.setMaxWaitMillis(MAX_WAIT);
		config.setTestOnBorrow(TEST_ON_BORROW);
		jedisPool = new JedisPool(config, IP, PORT, TIMEOUT);
	} catch (Exception e) {
		_log.error("First create JedisPool error : " + e);
	}
}
 
開發者ID:youngMen1,項目名稱:-Spring-SpringMVC-Mybatis-,代碼行數:16,代碼來源:RedisUtil.java

示例15: getRedisConnectionFactory

import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
private RedisConnectionFactory getRedisConnectionFactory(int database, String host, String password, int port, int maxIdle, int minIdle, int maxWait) {
    JedisConnectionFactory connectionFactory = new JedisConnectionFactory();
    connectionFactory.setDatabase(database);
    connectionFactory.setHostName(host);
    connectionFactory.setPassword(password);
    connectionFactory.setPort(port);
    JedisPoolConfig poolConfig = new JedisPoolConfig();
    poolConfig.setMaxIdle(maxIdle);
    poolConfig.setMinIdle(minIdle);
    poolConfig.setMaxWaitMillis(maxWait);
    poolConfig.setTestOnBorrow(true);
    poolConfig.setTestOnCreate(true);
    poolConfig.setTestWhileIdle(true);
    connectionFactory.setUsePool(true);
    return connectionFactory;
}
 
開發者ID:slking1987,項目名稱:mafia,代碼行數:17,代碼來源:RedisConfig.java


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