Search in sources :

Example 1 with JedisPoolConfig

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);
}
Also used : JedisPool(redis.clients.jedis.JedisPool) JedisPoolConfig(redis.clients.jedis.JedisPoolConfig)

Example 2 with JedisPoolConfig

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());
}
Also used : JedisPool(redis.clients.jedis.JedisPool) JedisPoolConfig(redis.clients.jedis.JedisPoolConfig)

Example 3 with JedisPoolConfig

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());
}
Also used : Jedis(redis.clients.jedis.Jedis) JedisPool(redis.clients.jedis.JedisPool) JedisPoolConfig(redis.clients.jedis.JedisPoolConfig) Test(org.junit.Test)

Example 4 with JedisPoolConfig

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);
}
Also used : JedisPool(redis.clients.jedis.JedisPool) JedisPoolConfig(redis.clients.jedis.JedisPoolConfig) Test(org.junit.Test)

Example 5 with JedisPoolConfig

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());
}
Also used : Jedis(redis.clients.jedis.Jedis) JedisPool(redis.clients.jedis.JedisPool) JedisPoolConfig(redis.clients.jedis.JedisPoolConfig) Test(org.junit.Test)

Aggregations

JedisPoolConfig (redis.clients.jedis.JedisPoolConfig)43 JedisPool (redis.clients.jedis.JedisPool)35 Test (org.junit.Test)30 Jedis (redis.clients.jedis.Jedis)28 HostAndPort (redis.clients.jedis.HostAndPort)6 JedisCluster (redis.clients.jedis.JedisCluster)6 LinkedHashSet (java.util.LinkedHashSet)4 HashSet (java.util.HashSet)3 URISyntaxException (java.net.URISyntaxException)2 RedisTicketRegistryProperties (org.apereo.cas.configuration.model.support.redis.RedisTicketRegistryProperties)2 Before (org.junit.Before)2 InvalidURIException (redis.clients.jedis.exceptions.InvalidURIException)2 JedisException (redis.clients.jedis.exceptions.JedisException)2 BeanWrapper (org.springframework.beans.BeanWrapper)1 BeanWrapperImpl (org.springframework.beans.BeanWrapperImpl)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Bean (org.springframework.context.annotation.Bean)1 JedisConnectionFactory (org.springframework.data.redis.connection.jedis.JedisConnectionFactory)1 JedisConnectionException (redis.clients.jedis.exceptions.JedisConnectionException)1 JedisExhaustedPoolException (redis.clients.jedis.exceptions.JedisExhaustedPoolException)1