@Test public void testLookup() { List<URL> lookup = zookeeperRegistry.lookup(serviceUrl); assertThat(lookup.size(), is(0)); zookeeperRegistry.register(serviceUrl); lookup = zookeeperRegistry.lookup(serviceUrl); assertThat(lookup.size(), is(1)); }
@Override public List<URL> lookup(URL url) { if (url == null) { throw new IllegalArgumentException("lookup url == null"); } try { List<String> providers = new ArrayList<String>(); for (String path : toCategoriesPath(url)) { List<String> children = zkClient.getChildren(path); if (children != null) { providers.addAll(children); } } return toUrlsWithoutEmpty(url, providers); } catch (Throwable e) { throw new RpcException("Failed to lookup " + url + " from zookeeper " + getUrl() + ", cause: " + e.getMessage(), e); } }
ZookeeperRegistry extends FailbackRegistry { @Override public List<URL> lookup(URL url) { if (url == null) { throw new IllegalArgumentException("lookup url == null"); } try { List<String> providers = new ArrayList<String>(); for (String path : toCategoriesPath(url)) { List<String> children = zkClient.getChildren(path); if (children != null) { providers.addAll(children); } } return toUrlsWithoutEmpty(url, providers); } catch (Throwable e) { throw new RpcException("Failed to lookup " + url + " from zookeeper " + getUrl() + ", cause: " + e.getMessage(), e); } } }
ZookeeperRegistry extends FailbackRegistry { @Override public List<URL> lookup(URL url) { if (url == null) { throw new IllegalArgumentException("lookup url == null"); } try { List<String> providers = new ArrayList<String>(); for (String path : toCategoriesPath(url)) { List<String> children = zkClient.getChildren(path); if (children != null) { providers.addAll(children); } } return toUrlsWithoutEmpty(url, providers); } catch (Throwable e) { throw new RpcException("Failed to lookup " + url + " from zookeeper " + getUrl() + ", cause: " + e.getMessage(), e); } } ZookeeperRegistry(URL url, ZookeeperTransporter zookeeperTransporter); }
ZookeeperRegistry extends FailbackRegistry { @Override public List<URL> lookup(URL url) { if (url == null) { throw new IllegalArgumentException("lookup url == null"); } try { List<String> providers = new ArrayList<String>(); for (String path : toCategoriesPath(url)) { List<String> children = zkClient.getChildren(path); if (children != null) { providers.addAll(children); } } return toUrlsWithoutEmpty(url, providers); } catch (Throwable e) { throw new RpcException("Failed to lookup " + url + " from zookeeper " + getUrl() + ", cause: " + e.getMessage(), e); } } ZookeeperRegistry(URL url, ZookeeperTransporter zookeeperTransporter); @Override boolean isAvailable(); @Override void destroy(); @Override List<URL> lookup(URL url); }
ZookeeperRegistry extends FailbackRegistry { @Override public List<URL> lookup(URL url) { if (url == null) { throw new IllegalArgumentException("lookup url == null"); } try { List<String> providers = new ArrayList<String>(); for (String path : toCategoriesPath(url)) { List<String> children = zkClient.getChildren(path); if (children != null) { providers.addAll(children); } } return toUrlsWithoutEmpty(url, providers); } catch (Throwable e) { throw new RpcException("Failed to lookup " + url + " from zookeeper " + getUrl() + ", cause: " + e.getMessage(), e); } } ZookeeperRegistry(URL url, ZookeeperTransporter zookeeperTransporter); @Override boolean isAvailable(); @Override void destroy(); @Override List<URL> lookup(URL url);  }