use of redis.clients.jedis.JedisPoolConfig in project qi4j-sdk by Qi4j.
the class RedisMapEntityStoreMixin method activateService.
@Override
public void activateService() throws Exception {
configuration.refresh();
RedisEntityStoreConfiguration config = configuration.get();
String host = config.host().get() == null ? DEFAULT_HOST : config.host().get();
int port = config.port().get() == null ? Protocol.DEFAULT_PORT : config.port().get();
int timeout = config.timeout().get() == null ? Protocol.DEFAULT_TIMEOUT : config.timeout().get();
String password = config.password().get();
int database = config.database().get() == null ? Protocol.DEFAULT_DATABASE : config.database().get();
pool = new JedisPool(new JedisPoolConfig(), host, port, timeout, password, database);
}
use of redis.clients.jedis.JedisPoolConfig in project presto by prestodb.
the class EmbeddedRedis method start.
public void start() throws IOException {
redisServer.start();
jedisPool = new JedisPool(new JedisPoolConfig(), getConnectString(), getPort());
}
use of redis.clients.jedis.JedisPoolConfig in project cachecloud by sohutv.
the class JedisPoolTest method checkJedisIsReusedWhenReturned.
@Test
public void checkJedisIsReusedWhenReturned() {
JedisPool pool = new JedisPool(new JedisPoolConfig(), hnp.getHost(), hnp.getPort());
Jedis jedis = pool.getResource();
jedis.auth("foobared");
jedis.set("foo", "0");
jedis.close();
jedis = pool.getResource();
jedis.auth("foobared");
jedis.incr("foo");
jedis.close();
pool.destroy();
assertTrue(pool.isClosed());
}
use of redis.clients.jedis.JedisPoolConfig in project cachecloud by sohutv.
the class JedisPoolTest method getNumActiveIsNegativeWhenPoolIsClosed.
@Test
public void getNumActiveIsNegativeWhenPoolIsClosed() {
JedisPool pool = new JedisPool(new JedisPoolConfig(), hnp.getHost(), hnp.getPort(), 2000, "foobared", 0, "my_shiny_client_name");
pool.destroy();
assertTrue(pool.getNumActive() < 0);
}
use of redis.clients.jedis.JedisPoolConfig in project cachecloud by sohutv.
the class JedisPoolTest method checkConnections.
@Test
public void checkConnections() {
JedisPool pool = new JedisPool(new JedisPoolConfig(), hnp.getHost(), hnp.getPort(), 2000);
Jedis jedis = pool.getResource();
jedis.auth("foobared");
jedis.set("foo", "bar");
assertEquals("bar", jedis.get("foo"));
jedis.close();
pool.destroy();
assertTrue(pool.isClosed());
}
Aggregations