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


Java JedisPoolConfig.setMinIdle方法代码示例

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


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

示例1: createJedisPoolConfig

import redis.clients.jedis.JedisPoolConfig; //导入方法依赖的package包/类
private static JedisPoolConfig createJedisPoolConfig(Builder builder) {
    JedisPoolConfig config = new JedisPoolConfig();
    config.setMaxTotal(builder.maxTotal);
    config.setMaxIdle(builder.maxIdle);
    config.setMinIdle(builder.minIdle);
    config.setLifo(builder.lifo);
    config.setFairness(builder.fairness);
    config.setMaxWaitMillis(builder.maxWaitMillis);
    config.setMinEvictableIdleTimeMillis(builder.minEvictableIdleTimeMillis);
    config.setSoftMinEvictableIdleTimeMillis(builder.softMinEvictableIdleTimeMillis);
    config.setNumTestsPerEvictionRun(builder.numTestsPerEvictionRun);
    config.setTestOnCreate(builder.testOnCreate);
    config.setTestOnBorrow(builder.testOnBorrow);
    config.setTestOnReturn(builder.testOnReturn);
    config.setTestWhileIdle(builder.testWhileIdle);
    config.setTimeBetweenEvictionRunsMillis(builder.timeBetweenEvictionRunsMillis);
    config.setEvictionPolicyClassName(builder.evictionPolicyClassName);
    config.setBlockWhenExhausted(builder.blockWhenExhausted);
    config.setJmxEnabled(builder.jmxEnabled);
    config.setJmxNameBase(builder.jmxNameBase);
    config.setJmxNamePrefix(builder.jmxNamePrefix);
    return config;
}
 
开发者ID:vy,项目名称:log4j2-redis-appender,代码行数:24,代码来源:RedisConnectionPoolConfig.java

示例2: JedisPoolConfigFactory

import redis.clients.jedis.JedisPoolConfig; //导入方法依赖的package包/类
private JedisPoolConfigFactory() {
	config = new JedisPoolConfig();
	//连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true
   	config.setBlockWhenExhausted(true);
   	//设置的逐出策略类名, 默认DefaultEvictionPolicy(当连接超过最大空闲时间,或连接数超过最大空闲连接数)
   	config.setEvictionPolicyClassName("org.apache.commons.pool2.impl.DefaultEvictionPolicy");
   	//是否启用pool的jmx管理功能, 默认true
   	config.setJmxEnabled(true);
   	//是否启用后进先出, 默认true
   	config.setLifo(true);
   	//最大空闲连接数, 默认8个
   	config.setMaxIdle(Integer.parseInt(Config.getAttribute("maxIdle")));
   	//最大连接数, 默认8个
   	config.setMaxTotal(Integer.parseInt(Config.getAttribute("maxTotal")));
   	//获取连接时的最大等待毫秒数(如果设置为阻塞时BlockWhenExhausted),如果超时就抛异常, 小于零:阻塞不确定的时间,  默认-1
   	config.setMaxWaitMillis(Integer.parseInt(Config.getAttribute("maxWait")));
   	//最小空闲连接数, 默认0
   	config.setMinIdle(Integer.parseInt(Config.getAttribute("minIdle")));
   	//在获取连接的时候检查有效性, 默认false
   	config.setTestOnBorrow(Boolean.parseBoolean(Config.getAttribute("testOnBorrow")));
   	//在空闲时检查有效性, 默认false
   	config.setTestWhileIdle(Boolean.parseBoolean(Config.getAttribute("testOnReturn")));
}
 
开发者ID:rocye,项目名称:wx-idk,代码行数:24,代码来源:JedisPoolConfigFactory.java

示例3: connectionFactory

import redis.clients.jedis.JedisPoolConfig; //导入方法依赖的package包/类
@Bean
public JedisConnectionFactory connectionFactory() {
  JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
  jedisPoolConfig.setMaxTotal(Integer.parseInt(env.getProperty(REDIS_POOL_MAX_ACTIVE)));
  jedisPoolConfig.setMaxIdle(Integer.parseInt(env.getProperty(REDIS_POOL_MAX_IDLE)));
  jedisPoolConfig.setMinIdle(Integer.parseInt(env.getProperty(REDIS_POOL_MIN_IDLE)));
  jedisPoolConfig.setMaxWaitMillis(Long.parseLong(env.getProperty(REDIS_POOL_MAX_WAIT)));
  jedisPoolConfig.setTestOnBorrow(true);
  jedisPoolConfig.setTestOnReturn(true);
  jedisPoolConfig.setTestWhileIdle(true);

  JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(jedisPoolConfig);
  jedisConnectionFactory.setUsePool(true);
  jedisConnectionFactory.setHostName(env.getProperty((REDIS_REMOTE_HOST)));
  return jedisConnectionFactory;
}
 
开发者ID:chuangxian,项目名称:lib-edge,代码行数:17,代码来源:RedisSessionConfiguration.java

示例4: getPoolConfig

import redis.clients.jedis.JedisPoolConfig; //导入方法依赖的package包/类
/**
 * 获取poolconfig
 *
 * @return
 */
public JedisPoolConfig getPoolConfig() {
    JedisPoolConfig config = new JedisPoolConfig();
    if (getMaxIdle() != 0) {
        config.setMaxIdle(getMaxIdle());
    }
    if (getMinIdle() != 0) {
        config.setMinIdle(getMinIdle());
    }
    if (getMaxWaitMillis() != 0) {
        config.setMaxWaitMillis(getMaxWaitMillis());
    }
    if (getMaxTotal() != 0) {
        config.setMaxTotal(getMaxTotal());
    }
    config.setTestOnBorrow(true);
    config.setTestWhileIdle(true);
    return config;
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:24,代码来源:AbstractRedisCacheClient.java

示例5: JedisHolder

import redis.clients.jedis.JedisPoolConfig; //导入方法依赖的package包/类
private JedisHolder(SpiderConfig config) {
    this.config = config;
    this.redisIp = this.config.getRedisIp();
    this.redisPort = this.config.getRedisPort();
    JedisPoolConfig config1 = new JedisPoolConfig();
    config1.setLifo(true);
    config1.setMaxIdle(8);
    config1.setMaxTotal(8);
    config1.setMaxWaitMillis(-1);
    config1.setMinEvictableIdleTimeMillis(1800000);
    config1.setMinIdle(0);
    config1.setNumTestsPerEvictionRun(3);
    config1.setSoftMinEvictableIdleTimeMillis(1800000);
    config1.setTestOnBorrow(false);
    config1.setTestWhileIdle(false);
    config1.setTimeBetweenEvictionRunsMillis(-1);

    this.jedisPool = new JedisPool(config1, this.redisIp, this.redisPort, 3000);
}
 
开发者ID:StevenKin,项目名称:ZhihuQuestionsSpider,代码行数:20,代码来源:JedisHolder.java

示例6: 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,代码来源:RedisClusterConfig.java

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

示例8: jedisPoolConfig

import redis.clients.jedis.JedisPoolConfig; //导入方法依赖的package包/类
private JedisPoolConfig jedisPoolConfig() {
    final RedisTicketRegistryProperties redis = casProperties.getTicket().getRegistry().getRedis();

    final JedisPoolConfig config = new JedisPoolConfig();
    final RedisTicketRegistryProperties.Pool props = redis.getPool();
    config.setMaxTotal(props.getMaxActive());
    config.setMaxIdle(props.getMaxIdle());
    config.setMinIdle(props.getMinIdle());
    config.setMaxWaitMillis(props.getMaxWait());
    return config;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:12,代码来源:RedisTicketRegistryConfiguration.java

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

示例10: buildPoolConfig

import redis.clients.jedis.JedisPoolConfig; //导入方法依赖的package包/类
private static JedisPoolConfig buildPoolConfig() {
	final JedisPoolConfig poolConfig = new JedisPoolConfig();
	poolConfig.setMaxTotal(128);
	poolConfig.setMaxIdle(128);
	poolConfig.setMinIdle(16);
	poolConfig.setTestOnBorrow(true);
	poolConfig.setTestOnReturn(true);
	poolConfig.setTestWhileIdle(true);
	poolConfig.setMinEvictableIdleTimeMillis(Duration.ofSeconds(60).toMillis());
	poolConfig.setTimeBetweenEvictionRunsMillis(Duration.ofSeconds(30).toMillis());
	poolConfig.setNumTestsPerEvictionRun(3);
	poolConfig.setBlockWhenExhausted(true);

	return poolConfig;
}
 
开发者ID:SystemOfAProg,项目名称:VS2Labor,代码行数:16,代码来源:JedisFactory.java

示例11: afterPropertiesSet

import redis.clients.jedis.JedisPoolConfig; //导入方法依赖的package包/类
/**
 * 初始化redisUtil实例,配置连接池
 */
public void afterPropertiesSet() throws Exception {

    JedisPoolConfig config = new JedisPoolConfig();
    config.setMaxTotal(maxTotal);
    config.setMaxIdle(maxIdle);
    config.setMinIdle(minIdle);
    config.setMaxWaitMillis(holed);
    config.setTestOnBorrow(false);

    pool = new JedisPool(config, host, port, timeout, password, DB);

}
 
开发者ID:TwoDragonLake,项目名称:tdl-seckill,代码行数:16,代码来源:RedisUtil.java

示例12: jedisPoolConfig

import redis.clients.jedis.JedisPoolConfig; //导入方法依赖的package包/类
@Bean
public JedisPoolConfig jedisPoolConfig() {
    JedisPoolConfig config = new JedisPoolConfig();
    config.setMinIdle(PropertiesUtil.getInt("redis.minIdle"));
    config.setMaxIdle(PropertiesUtil.getInt("redis.maxIdle"));
    config.setMaxTotal(PropertiesUtil.getInt("redis.maxTotal"));
    config.setMaxWaitMillis(PropertiesUtil.getInt("redis.maxWaitMillis"));
    config.setTestOnBorrow(Boolean.valueOf(PropertiesUtil.getString("redis.testOnBorrow")));
    return config;
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:11,代码来源:JedisConfig.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: getPoolConfig

import redis.clients.jedis.JedisPoolConfig; //导入方法依赖的package包/类
/**
 * method to get jedis pool configuration
 * 
 * @param properties
 * @return
 */
private JedisPoolConfig getPoolConfig(Properties properties) {
	JedisPoolConfig poolConfig = new JedisPoolConfig();
	int maxActive = Integer.parseInt(properties.getProperty(RedisConstants.MAX_ACTIVE, RedisConstants.DEFAULT_MAX_ACTIVE_VALUE));
	poolConfig.setMaxTotal(maxActive);

	boolean testOnBorrow = Boolean.parseBoolean(properties.getProperty(RedisConstants.TEST_ONBORROW, RedisConstants.DEFAULT_TEST_ONBORROW_VALUE));
	poolConfig.setTestOnBorrow(testOnBorrow);

	boolean testOnReturn = Boolean.parseBoolean(properties.getProperty(RedisConstants.TEST_ONRETURN, RedisConstants.DEFAULT_TEST_ONRETURN_VALUE));
	poolConfig.setTestOnReturn(testOnReturn);

	int maxIdle = Integer.parseInt(properties.getProperty(RedisConstants.MAX_ACTIVE, RedisConstants.DEFAULT_MAX_ACTIVE_VALUE));
	poolConfig.setMaxIdle(maxIdle);

	int minIdle = Integer.parseInt(properties.getProperty(RedisConstants.MIN_IDLE, RedisConstants.DEFAULT_MIN_IDLE_VALUE));
	poolConfig.setMinIdle(minIdle);

	boolean testWhileIdle = Boolean.parseBoolean(properties.getProperty(RedisConstants.TEST_WHILEIDLE, RedisConstants.DEFAULT_TEST_WHILEIDLE_VALUE));
	poolConfig.setTestWhileIdle(testWhileIdle);

	int testNumPerEviction = Integer.parseInt(properties.getProperty(RedisConstants.TEST_NUMPEREVICTION, RedisConstants.DEFAULT_TEST_NUMPEREVICTION_VALUE));
	poolConfig.setNumTestsPerEvictionRun(testNumPerEviction);

	long timeBetweenEviction = Long.parseLong(properties.getProperty(RedisConstants.TIME_BETWEENEVICTION, RedisConstants.DEFAULT_TIME_BETWEENEVICTION_VALUE));
	poolConfig.setTimeBetweenEvictionRunsMillis(timeBetweenEviction);
	return poolConfig;
}
 
开发者ID:ran-jit,项目名称:distributed-task-scheduler,代码行数:34,代码来源:RedisDataCache.java

示例15: init

import redis.clients.jedis.JedisPoolConfig; //导入方法依赖的package包/类
public void init() {

		try {
			String[] hosts = servers.trim().split("\\|");

			List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();

			for (String host : hosts) {
				String[] ss = host.split(":");
				//升级 redis  构造变化
				JedisShardInfo shard = new JedisShardInfo(ss[0], Integer.parseInt(ss[1]), DEFAULT_TIMEOUT, DEFAULT_TIMEOUT, 1);
				shards.add(shard);
			}

			JedisPoolConfig config = new JedisPoolConfig();
			config.setMaxIdle(MAX_ACTIVE);
			config.setMinIdle(MAX_IDLE);
			config.setMaxWaitMillis(MAX_WAIT);
			config.setMaxTotal(MAX_TOTAL);

			pool = new ShardedJedisPool(config, shards, Hashing.MURMUR_HASH);
		} catch (NumberFormatException e) {
			System.out.println("redis客户端初始化连接异常!!!!!!!!!  链接参数:" + servers
					+ " " + DEFAULT_TIMEOUT + " " + app);
			logger.error("redis:{},exception:{}.", servers + " "
					+ DEFAULT_TIMEOUT + " " + app, e.getMessage());
		}
	}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:29,代码来源:RedisCacheClient.java


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