本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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"));
}
示例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);
}
}
示例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;
}