zookeeper
zookeeper copied to clipboard
ZOOKEEPER-4749: Respect zookeeper.request.timeout also for asynchronous api
Currently, zookeeper.request.timeout is only respected in synchronous api. I think there are should be no much differences between following two.
String createdPath = zk.create("/path", data, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
CompletableFuture<String> future = new CompletableFuture<>();
zk.create("/path", data, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, (rc, path, ctx, name) -> {
if (rc == 0) {
future.complete(name);
} else {
future.completeExceptionally(KeeperException.create(KeeperException.Code.get(rc), path));
}
}, null);
String createdPath = future.join();
After this pr, we are able to unify synchronous api through calls to asynchronous api as review comments pointed out if we feel there are too much identical code between synchronous and asynchronous api.
We recently encountered this issue, too. Do we have any update to this PR?