@Test public void testAvailableWithBackup() { URL url = URL.valueOf("redis: Registry registry = new RedisRegistryFactory().createRegistry(url); assertThat(registry.isAvailable(), is(false)); url = URL.valueOf(this.registryUrl.toFullString()).addParameter(BACKUP_KEY, "redisTwo:8881"); registry = new RedisRegistryFactory().createRegistry(url); assertThat(registry.isAvailable(), is(true)); }
@Override public boolean isAvailable() { for (JedisPool jedisPool : jedisPools.values()) { try { Jedis jedis = jedisPool.getResource(); try { if (jedis.isConnected()) { return true; } } finally { jedis.close(); } } catch (Throwable t) { } } return false; }
RedisRegistry extends FailbackRegistry { @Override public boolean isAvailable() { for (JedisPool jedisPool : jedisPools.values()) { try { Jedis jedis = jedisPool.getResource(); try { if (jedis.isConnected()) { return true; } } finally { jedis.close(); } } catch (Throwable t) { } } return false; } }
RedisRegistry extends FailbackRegistry { @Override public boolean isAvailable() { for (JedisPool jedisPool : jedisPools.values()) { try { Jedis jedis = jedisPool.getResource(); try { if (jedis.isConnected()) { return true; } } finally { jedis.close(); } } catch (Throwable t) { } } return false; } RedisRegistry(URL url); }
RedisRegistry extends FailbackRegistry { @Override public boolean isAvailable() { for (JedisPool jedisPool : jedisPools.values()) { try { Jedis jedis = jedisPool.getResource(); try { if (jedis.isConnected()) { return true; } } finally { jedis.close(); } } catch (Throwable t) { } } return false; } RedisRegistry(URL url); @Override boolean isAvailable(); @Override void destroy(); @Override void doRegister(URL url); @Override void doUnregister(URL url); @Override void doSubscribe(final URL url, final NotifyListener listener); @Override void doUnsubscribe(URL url, NotifyListener listener); }
RedisRegistry extends FailbackRegistry { @Override public boolean isAvailable() { for (JedisPool jedisPool : jedisPools.values()) { try { Jedis jedis = jedisPool.getResource(); try { if (jedis.isConnected()) { return true; } } finally { jedis.close(); } } catch (Throwable t) { } } return false; } RedisRegistry(URL url); @Override boolean isAvailable(); @Override void destroy(); @Override void doRegister(URL url); @Override void doUnregister(URL url); @Override void doSubscribe(final URL url, final NotifyListener listener); @Override void doUnsubscribe(URL url, NotifyListener listener);  }