zookeeper icon indicating copy to clipboard operation
zookeeper copied to clipboard

ZOOKEEPER-4749: Respect zookeeper.request.timeout also for asynchronous api

Open kezhuw opened this issue 1 year ago • 1 comments

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.

kezhuw avatar May 29 '24 06:05 kezhuw

We recently encountered this issue, too. Do we have any update to this PR?

showuon avatar Dec 02 '24 07:12 showuon