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


Java JedisPoolConfig.setTestOnCreate方法代码示例

本文整理汇总了Java中redis.clients.jedis.JedisPoolConfig.setTestOnCreate方法的典型用法代码示例。如果您正苦于以下问题:Java JedisPoolConfig.setTestOnCreate方法的具体用法?Java JedisPoolConfig.setTestOnCreate怎么用?Java JedisPoolConfig.setTestOnCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在redis.clients.jedis.JedisPoolConfig的用法示例。


在下文中一共展示了JedisPoolConfig.setTestOnCreate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Client

import redis.clients.jedis.JedisPoolConfig; //导入方法依赖的package包/类
/**
 * Create a new client to a RediSearch index
 * @param indexName the name of the index we are connecting to or creating
 * @param host the redis host
 * @param port the redis pot
 */
public Client(String indexName, String host, int port, int timeout, int poolSize) {
    JedisPoolConfig conf = new JedisPoolConfig();
    conf.setMaxTotal(poolSize);
    conf.setTestOnBorrow(false);
    conf.setTestOnReturn(false);
    conf.setTestOnCreate(false);
    conf.setTestWhileIdle(false);
    conf.setMinEvictableIdleTimeMillis(60000);
    conf.setTimeBetweenEvictionRunsMillis(30000);
    conf.setNumTestsPerEvictionRun(-1);
    conf.setFairness(true);

    pool = new JedisPool(conf, host, port, timeout);

    this.indexName = indexName;
    this.commands = new Commands.SingleNodeCommands();
}
 
开发者ID:RedisLabs,项目名称:JRediSearch,代码行数:24,代码来源:Client.java

示例2: 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

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