Package redis.clients.jedis

Examples of redis.clients.jedis.JedisPool.destroy()


  Jedis jedis = pool.getResource();
  jedis.auth("foobared");
  jedis.set("foo", "bar");
  assertEquals("bar", jedis.get("foo"));
  pool.returnResource(jedis);
  pool.destroy();
  assertTrue(pool.isClosed());
    }

    @Test
    public void checkCloseableConnections() throws Exception {
View Full Code Here


  Jedis jedis = pool.getResource();
  jedis.auth("foobared");
  jedis.set("foo", "bar");
  assertEquals("bar", jedis.get("foo"));
  pool.returnResource(jedis);
  pool.destroy();
  assertTrue(pool.isClosed());
    }

    @Test
    public void checkJedisIsReusedWhenReturned() {
View Full Code Here

  jedis = pool.getResource();
  jedis.auth("foobared");
  jedis.incr("foo");
  pool.returnResource(jedis);
  pool.destroy();
  assertTrue(pool.isClosed());
    }

    @Test
    public void checkPoolRepairedWhenJedisIsBroken() {
View Full Code Here

  jedis = pool.getResource();
  jedis.auth("foobared");
  jedis.incr("foo");
  pool.returnResource(jedis);
  pool.destroy();
  assertTrue(pool.isClosed());
    }

    @Test(expected = JedisConnectionException.class)
    public void checkPoolOverflow() {
View Full Code Here

  JedisPool pool = new JedisPool(config, hnp.getHost(), hnp.getPort(),
    2000, "foobared");
  Jedis jedis = pool.getResource();
  jedis.set("foo", "bar");
  pool.returnResource(jedis);
  pool.destroy();
  assertTrue(pool.isClosed());
    }

    @Test
    public void nonDefaultDatabase() {
View Full Code Here

    hnp.getPort(), 2000, "foobared");
  Jedis jedis0 = pool0.getResource();
  jedis0.set("foo", "bar");
  assertEquals("bar", jedis0.get("foo"));
  pool0.returnResource(jedis0);
  pool0.destroy();
  assertTrue(pool0.isClosed());

  JedisPool pool1 = new JedisPool(new JedisPoolConfig(), hnp.getHost(),
    hnp.getPort(), 2000, "foobared", 1);
  Jedis jedis1 = pool1.getResource();
View Full Code Here

  JedisPool pool1 = new JedisPool(new JedisPoolConfig(), hnp.getHost(),
    hnp.getPort(), 2000, "foobared", 1);
  Jedis jedis1 = pool1.getResource();
  assertNull(jedis1.get("foo"));
  pool1.returnResource(jedis1);
  pool1.destroy();
  assertTrue(pool1.isClosed());
    }

    @Test
    public void startWithUrlString() {
View Full Code Here

  Jedis jedis1 = pool.getResource();
  assertTrue("Jedis instance was not reused", jedis1 == jedis0);
  assertEquals(0L, jedis1.getDB().longValue());

  pool.returnResource(jedis1);
  pool.destroy();
  assertTrue(pool.isClosed());
    }

    @Test
    public void customClientName() {
View Full Code Here

  Jedis jedis = pool0.getResource();

  assertEquals("my_shiny_client_name", jedis.clientGetname());

  pool0.returnResource(jedis);
  pool0.destroy();
  assertTrue(pool0.isClosed());
    }

    @Test
    public void returnResourceShouldResetState() {
View Full Code Here

      assertEquals("jedis", jedis2.get("hello"));
  } finally {
      jedis2.close();
  }

  pool.destroy();
  assertTrue(pool.isClosed());
    }

    @Test
    public void checkResourceIsCloseable() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.