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<>(); 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 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); @Override List<URL> lookup(URL url);  }
@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)); }