diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestZkMetaClient.java b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestZkMetaClient.java index 19f21977b0b..86edbf8ebed 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestZkMetaClient.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestZkMetaClient.java @@ -517,12 +517,20 @@ public void handleDataChange(String key, Object data, ChangeType changeType) throws Exception { } }; - zkMetaClient.subscribeDataChange(basePath, listener, false); + DirectChildChangeListener cldListener = new DirectChildChangeListener() { + + @Override + public void handleDirectChildChange(String key) throws Exception { + + } + }; + zkMetaClient.subscribeDataChange(basePath, listener, true); zkMetaClient.create(basePath, ""); zkMetaClient.get(basePath); zkMetaClient.exists(basePath); zkMetaClient.getDataAndStat(basePath); zkMetaClient.getDirectChildrenKeys(basePath); + zkMetaClient.subscribeDirectChildChange(basePath, cldListener, true); } } diff --git a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java index 2a06158d090..110587e09ca 100644 --- a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java +++ b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java @@ -1474,7 +1474,7 @@ public int countChildren(String path) { } public boolean exists(final String path) { - return exists(path, hasChildOrDataListeners(path)); + return exists(path, (!_usePersistWatcher) && hasChildOrDataListeners(path)); } protected boolean exists(final String path, final boolean watch) {