I have read some documentation about Zookeeper.sync() that makes me
think there is no need to wait on its callback before reading data,
but its not explicitly stated in what I have read. I am wondering if
the following code is a reasonable way to get the latest data for
'/a/b'?
ZooKeeper zooKeeper = null;
AsyncCallback.VoidCallback cb;
CompletableFuture<Integer> returnCode = new CompletableFuture<>();
zooKeeper.sync("/a/b", (rc, path, ctx) -> returnCode.complete(rc), null);
zooKeeper.getData("/a/b",false, null);
if(returnCode.get() != 0) {
//handle problem with sync
}
Thanks
Keith