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


Java JedisPoolConfig.setJmxEnabled方法代码示例

本文整理汇总了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;
}
 
开发者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: 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.");
}
 
开发者ID:SamaGames,项目名称:Hydroangeas,代码行数:24,代码来源:DatabaseConnector.java

示例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;
}
 
开发者ID:x7-framework,项目名称:x7,代码行数:19,代码来源:JedisConnector_Persistence.java

示例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();
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:20,代码来源:DatabaseConnector.java

示例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;
}
 
开发者ID:x7-framework,项目名称:x7,代码行数:15,代码来源:JedisConnector_Cache.java

示例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;
}
 
开发者ID:x7-framework,项目名称:x7,代码行数:15,代码来源:JedisConnector_Cache3.java


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