Github user jiazhai commented on a diff in the pull request: https://github.com/apache/incubator-distributedlog/pull/133#discussion_r119984925 --- Diff: distributedlog-core/src/main/java/org/apache/distributedlog/util/Utils.java --- @@ -445,35 +440,35 @@ public void processResult(int rc, String path, Object ctx) { * false if the node doesn't exist, otherwise future will throw exception * */ - public static Future<Boolean> zkDeleteIfNotExist(ZooKeeperClient zkc, String path, ZkVersion version) { + public static CompletableFuture<Boolean> zkDeleteIfNotExist(ZooKeeperClient zkc, String path, ZkVersion version) { ZooKeeper zk; try { zk = zkc.get(); } catch (ZooKeeperClient.ZooKeeperConnectionException e) { - return Future.exception(FutureUtils.zkException(e, path)); + return FutureUtils.exception(zkException(e, path)); } catch (InterruptedException e) { - return Future.exception(FutureUtils.zkException(e, path)); + return FutureUtils.exception(zkException(e, path)); } - final Promise<Boolean> promise = new Promise<Boolean>(); + final CompletableFuture<Boolean> promise = new CompletableFuture<Boolean>(); zk.delete(path, version.getZnodeVersion(), new AsyncCallback.VoidCallback() { @Override public void processResult(int rc, String path, Object ctx) { if (KeeperException.Code.OK.intValue() == rc ) { - promise.setValue(true); + promise.complete(true); } else if (KeeperException.Code.NONODE.intValue() == rc) { - promise.setValue(false); + promise.complete(false); } else { - promise.setException(KeeperException.create(KeeperException.Code.get(rc))); + promise.completeExceptionally(KeeperException.create(KeeperException.Code.get(rc))); } } }, null); return promise; } - public static Future<Void> asyncClose(@Nullable AsyncCloseable closeable, + public static CompletableFuture<Void> asyncClose(@Nullable AsyncCloseable closeable, boolean swallowIOException) { --- End diff -- Please also do the code alignment change here, and line 573, 586.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---