Examples of returnResource()


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

      assertEquals("2", jedis.mget("def").get(0));
      assertEquals(null, jedis.mget("xyz").get(0));
      pool.returnResource(jedis);
    } finally {
      if (jedis != null)
        pool.returnResource(jedis);
      redisServer.stop();
    }
  }

    @Test
View Full Code Here

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

            jedis.mset("abc", "1", "def", "2");

            assertEquals("1", jedis.mget("abc").get(0));
            assertEquals("2", jedis.mget("def").get(0));
            assertEquals(null, jedis.mget("xyz").get(0));
            pool.returnResource(jedis);
        } finally {
            if (jedis != null)
                pool.returnResource(jedis);
        }
    }
View Full Code Here

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

            assertEquals("2", jedis.mget("def").get(0));
            assertEquals(null, jedis.mget("xyz").get(0));
            pool.returnResource(jedis);
        } finally {
            if (jedis != null)
                pool.returnResource(jedis);
        }
    }


    @After
View Full Code Here

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

                        throw re;
                    }
                    finally {
                        if(resource != null) {
                            try {
                                jedisPool.returnResource(resource);
                            }
                            catch (Throwable t) {
                                logger.warn("returnResource error: " + t.getMessage(), t);
                            }
                        }
View Full Code Here

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

   *            connection to be returned
   */
  public void returnJedis(String host, Jedis jedis) {
    JedisPool pool = this.pools.get(host);
    if (pool != null) {
      pool.returnResource(jedis);
    }
  }
}
View Full Code Here

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

                    }
                    if (admin) {
                        clean(jedis);
                    }
                } finally {
                    jedisPool.returnResource(jedis);
                }
            } catch (Throwable t) {
                logger.warn("Failed to write provider heartbeat to redis registry. registry: " + entry.getKey() + ", cause: " + t.getMessage(), t);
            }
        }
View Full Code Here

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

                try {
                    jedis.hset(key, value, expire);
                    jedis.publish(key, Constants.REGISTER);
                    success = true;
                } finally {
                    jedisPool.returnResource(jedis);
                }
            } catch (Throwable t) {
                exception = new RpcException("Failed to register service to redis registry. registry: " + entry.getKey() + ", service: " + url + ", cause: " + t.getMessage(), t);
            }
        }
View Full Code Here

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

                Jedis jedis = jedisPool.getResource();
                try {
                    jedis.hdel(key, value);
                    jedis.publish(key, Constants.UNREGISTER);
                } finally {
                    jedisPool.returnResource(jedis);
                }
            } catch (Throwable t) {
                exception = new RpcException("Failed to unregister service to redis registry. registry: " + entry.getKey() + ", service: " + url + ", cause: " + t.getMessage(), t);
            }
        }
View Full Code Here

Examples of redis.clients.jedis.JedisSentinelPool.returnResource()

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

    @Test
View Full Code Here

Examples of redis.clients.jedis.JedisSentinelPool.returnResource()

  try {
      jedis.set("hello", "jedis");
      Transaction t = jedis.multi();
      t.set("hello", "world");
      pool.returnResource(jedis);

      jedis2 = pool.getResource();

      assertTrue(jedis == jedis2);
      assertEquals("jedis", jedis2.get("hello"));
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.