use of redis.clients.jedis.JedisPoolConfig in project ignite by apache.
the class RedisCommonAbstractTest method beforeTestsStarted.
/**
* {@inheritDoc}
*/
@Override
protected void beforeTestsStarted() throws Exception {
startGrids(gridCount());
JedisPoolConfig jedisPoolCfg = new JedisPoolConfig();
jedisPoolCfg.setMaxWaitMillis(20000);
jedisPoolCfg.setMaxIdle(100);
jedisPoolCfg.setMinIdle(1);
jedisPoolCfg.setNumTestsPerEvictionRun(10);
jedisPoolCfg.setTestOnBorrow(true);
jedisPoolCfg.setTestOnReturn(true);
jedisPoolCfg.setTestWhileIdle(true);
jedisPoolCfg.setTimeBetweenEvictionRunsMillis(30000);
pool = new JedisPool(jedisPoolCfg, HOST, PORT, 10000);
}
use of redis.clients.jedis.JedisPoolConfig in project leopard by tanhaichao.
the class RedisPool method getConfig.
public static GenericObjectPoolConfig getConfig() {
JedisPoolConfig poolConfig = new JedisPoolConfig();
// poolConfig.setMaxActive(8);// CPU数量即可
// CPU数量即可
poolConfig.setMaxTotal(8);
return poolConfig;
}
use of redis.clients.jedis.JedisPoolConfig in project leopard by tanhaichao.
the class JedisPoolTest method JedisPool.
@Test
public void JedisPool() {
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(1);
String host = "172.17.1.236";
int port = 6311;
int timeout = 3000;
JedisPool pool = new JedisPool(poolConfig, host, port, timeout, null);
{
Jedis jedis = pool.getResource();
pool.returnBrokenResource(jedis);
pool.returnResource(jedis);
}
{
RedisConnectionListener redisConnectionListener = Mockito.mock(RedisConnectionListener.class);
pool.redisConnectionListener = redisConnectionListener;
Jedis jedis = pool.getResource();
pool.returnBrokenResource(jedis);
pool.returnResource(jedis);
}
}
use of redis.clients.jedis.JedisPoolConfig in project oxCore by GluuFederation.
the class RedisClusterProvider method create.
public void create() {
try {
LOG.debug("Starting RedisClusterProvider ... configuration:" + getRedisConfiguration());
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(1000);
poolConfig.setMinIdle(2);
pool = new JedisCluster(hosts(getRedisConfiguration().getServers()), poolConfig);
testConnection();
LOG.debug("RedisClusterProvider started.");
} catch (Exception e) {
LOG.error("Failed to start RedisClusterProvider.");
throw new IllegalStateException("Error starting RedisClusterProvider", e);
}
}
use of redis.clients.jedis.JedisPoolConfig in project oxCore by GluuFederation.
the class RedisShardedProvider method create.
public void create() {
try {
LOG.debug("Starting RedisShardedProvider ... configuration:" + redisConfiguration);
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(1000);
poolConfig.setMinIdle(2);
pool = new ShardedJedisPool(poolConfig, shards(redisConfiguration.getServers()));
testConnection();
LOG.debug("RedisShardedProvider started.");
} catch (Exception e) {
LOG.error("Failed to start RedisShardedProvider.");
throw new IllegalStateException("Error starting RedisShardedProvider", e);
}
}
Aggregations