当前位置: 首页>>代码示例>>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;未经允许,请勿转载。