ZkclientZookeeperClient extends AbstractZookeeperClient<IZkChildListener> { @Override public boolean checkExists(String path) { try { return client.exists(path); } catch (Throwable t) { } return false; } ZkclientZookeeperClient(String serverAddr); @Override void createPersistent(String path); @Override void createEphemeral(String path); @Override void delete(String path); @Override List<String> getChildren(String path); @Override boolean checkExists(String path); @Override boolean isConnected(); @Override void doClose(); @Override IZkChildListener createTargetChildListener(String path, final ChildListener listener); @Override List<String> addTargetChildListener(String path, final IZkChildListener listener); @Override void removeTargetChildListener(String path, IZkChildListener listener);  }
@Test public void testCheckExists() { String path = "/dubbo/org.apache.dubbo.demo.DemoService/providers"; zkclientZookeeperClient.create(path, false); assertThat(zkclientZookeeperClient.checkExists(path), is(true)); assertThat(zkclientZookeeperClient.checkExists(path + "/noneexits"), is(false)); }