本文整理匯總了Java中redis.clients.jedis.JedisPoolConfig.setJmxEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java JedisPoolConfig.setJmxEnabled方法的具體用法?Java JedisPoolConfig.setJmxEnabled怎麽用?Java JedisPoolConfig.setJmxEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類redis.clients.jedis.JedisPoolConfig
的用法示例。
在下文中一共展示了JedisPoolConfig.setJmxEnabled方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例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")));
}
示例3: connect
import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
public void connect()
{
this.instance.log(Level.INFO, "Connecting to database...");
JedisPoolConfig jedisConfiguration = new JedisPoolConfig();
jedisConfiguration.setMaxTotal(-1);
jedisConfiguration.setJmxEnabled(false);
Logger logger = Logger.getLogger(JedisPool.class.getName());
logger.setLevel(Level.OFF);
this.jedisPool = new JedisPool(jedisConfiguration, this.instance.getConfiguration().redisIp, this.instance.getConfiguration().redisPort, 0, this.instance.getConfiguration().redisPassword);
try
{
this.jedisPool.getResource().close();
} catch (Exception e)
{
this.instance.log(Level.SEVERE, "Can't connect to the database!");
System.exit(8);
}
this.instance.log(Level.INFO, "Connected to database.");
}
示例4: 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;
}
示例5: connect
import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
private void connect()
{
JedisPoolConfig config = new JedisPoolConfig();
config.setMaxTotal(-1);
config.setJmxEnabled(false);
try
{
this.cachePool = new JedisPool(config, this.bungee.getIp(), this.bungee.getPort(), 0, this.bungee.getPassword());
this.cachePool.getResource().close();
this.plugin.log(Level.INFO, "Connected to database.");
}
catch (Exception e)
{
plugin.getLogger().log(Level.SEVERE, "Can't connect to the database!", e);
Bukkit.shutdown();
}
}
示例6: 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;
}
示例7: getInstance
import redis.clients.jedis.JedisPoolConfig; //導入方法依賴的package包/類
public static JedisConnector_Cache3 getInstance(){
if (instance == null){
instance = new JedisConnector_Cache3();
JedisPoolConfig config = new JedisPoolConfig();
config.setMaxTotal(Configs.getIntValue("x7.redis.max"));
config.setMaxIdle(Configs.getIntValue("x7.redis.idle"));
config.setJmxEnabled(true);
config.setJmxNamePrefix("redis-cahce3");
config.setTestOnBorrow(true);
pool = new JedisPool( config, Configs.getString("x7.redis.ip.cache3"), Configs.getIntValue("x7.redis.port.cache3")); //6379
}
return instance;
}