Skip to content

Commit

Permalink
Skip one time listener re-register for exists for ZkClient - MetaClie…
Browse files Browse the repository at this point in the history
…nt usage. (#2637)
  • Loading branch information
xyuanlu authored Sep 27, 2023
1 parent 0555e93 commit 34ec3c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 34ec3c6

Please sign in to comment.