本文整理匯總了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;
}