Examples of returnBrokenResource()


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

  JedisPool pool = new JedisPool(new JedisPoolConfig(), hnp.getHost(),
    hnp.getPort());
  Jedis jedis = pool.getResource();
  jedis.auth("foobared");
  jedis.quit();
  pool.returnBrokenResource(jedis);

  jedis = pool.getResource();
  jedis.auth("foobared");
  jedis.incr("foo");
  pool.returnResource(jedis);
View Full Code Here

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

    @Test
    public void returnNullObjectShouldNotFail() {
  JedisPool pool = new JedisPool(new JedisPoolConfig(), hnp.getHost(),
    hnp.getPort(), 2000, "foobared", 0, "my_shiny_client_name");

  pool.returnBrokenResource(null);
  pool.returnResource(null);
  pool.returnResourceObject(null);
    }

    @Test
View Full Code Here

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

                                            }
                                            jedis.psubscribe(new NotifySub(jedisPool), service + Constants.PATH_SEPARATOR + Constants.ANY_VALUE); // 阻塞
                                        }
                                        break;
                                    } finally {
                                        jedisPool.returnBrokenResource(jedis);
                                    }
                                } catch (Throwable t) { // 重试另一台
                                    logger.warn("Failed to subscribe service from redis registry. registry: " + entry.getKey() + ", cause: " + t.getMessage(), t);
                                }
                            }
View Full Code Here

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

                                            }
                                            jedis.psubscribe(new NotifySub(jedisPool), service + Constants.PATH_SEPARATOR + Constants.ANY_VALUE); // 阻塞
                                        }
                                        break;
                                    } finally {
                                        jedisPool.returnBrokenResource(jedis);
                                    }
                                } catch (Throwable t) { // 重试另一台
                                    logger.warn("Failed to subscribe service from redis registry. registry: " + entry.getKey() + ", cause: " + t.getMessage(), t);
                                }
                            }
View Full Code Here

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

                                            }
                                            jedis.psubscribe(new NotifySub(jedisPool), service + Constants.PATH_SEPARATOR + Constants.ANY_VALUE); // 阻塞
                                        }
                                        break;
                                    } finally {
                                        jedisPool.returnBrokenResource(jedis);
                                    }
                                } catch (Throwable t) { // 重试另一台
                                    logger.warn("Failed to subscribe service from redis registry. registry: " + entry.getKey() + ", cause: " + t.getMessage(), t);
                                    // 如果在单台redis的情况下,需要休息一会,避免空转占用过多cpu资源
                                    sleep(reconnectPeriod);
View Full Code Here

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

                                            }
                                            jedis.psubscribe(new NotifySub(jedisPool), service + Constants.PATH_SEPARATOR + Constants.ANY_VALUE); // 阻塞
                                        }
                                        break;
                                    } finally {
                                        jedisPool.returnBrokenResource(jedis);
                                    }
                                } catch (Throwable t) { // 重试另一台
                                    logger.warn("Failed to subscribe service from redis registry. registry: " + entry.getKey() + ", cause: " + t.getMessage(), t);
                                }
                            }
View Full Code Here

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

                                            }
                                            jedis.psubscribe(new NotifySub(jedisPool), service + Constants.PATH_SEPARATOR + Constants.ANY_VALUE); // 阻塞
                                        }
                                        break;
                                    } finally {
                                        jedisPool.returnBrokenResource(jedis);
                                    }
                                } catch (Throwable t) { // 重试另一台
                                    logger.warn("Failed to subscribe service from redis registry. registry: " + entry.getKey() + ", cause: " + t.getMessage(), t);
                                }
                            }
View Full Code Here

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

                                            }
                                            jedis.subscribe(new NotifySub(jedisPool), service + Constants.PATH_SEPARATOR + Constants.PROVIDERS); // 阻塞
                                        }
                                        break;
                                    } finally {
                                        jedisPool.returnBrokenResource(jedis);
                                    }
                                } catch (Throwable t) { // 重试另一台
                                    logger.warn("Failed to subscribe service from redis registry. registry: " + entry.getKey() + ", cause: " + t.getMessage(), t);
                                }
                            }
View Full Code Here

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

      assertTrue(jedis == jedis2);
      assertEquals("jedis", jedis2.get("hello"));
  } catch (JedisConnectionException e) {
      if (jedis2 != null) {
    pool.returnBrokenResource(jedis2);
    jedis2 = null;
      }
  } finally {
      if (jedis2 != null)
    pool.returnResource(jedis2);
View Full Code Here

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

  config.setBlockWhenExhausted(false);
  JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels,
    config, 1000, "foobared", 2);

  Jedis nullJedis = null;
  pool.returnBrokenResource(nullJedis);
  pool.destroy();
    }

    private void forceFailover(JedisSentinelPool pool)
      throws InterruptedException {
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.