Github user jiazhai commented on a diff in the pull request: https://github.com/apache/incubator-distributedlog/pull/133#discussion_r119984686 --- Diff: distributedlog-core/src/main/java/org/apache/distributedlog/BookKeeperClient.java --- @@ -198,52 +196,52 @@ public synchronized BookKeeper get() throws IOException { } // Util functions - public Future<LedgerHandle> createLedger(int ensembleSize, - int writeQuorumSize, - int ackQuorumSize) { + public CompletableFuture<LedgerHandle> createLedger(int ensembleSize, + int writeQuorumSize, + int ackQuorumSize) { BookKeeper bk; try { bk = get(); } catch (IOException ioe) { - return Future.exception(ioe); + return FutureUtils.exception(ioe); } - final Promise<LedgerHandle> promise = new Promise<LedgerHandle>(); + final CompletableFuture<LedgerHandle> promise = new CompletableFuture<LedgerHandle>(); bk.asyncCreateLedger(ensembleSize, writeQuorumSize, ackQuorumSize, BookKeeper.DigestType.CRC32, passwd, new AsyncCallback.CreateCallback() { @Override public void createComplete(int rc, LedgerHandle lh, Object ctx) { if (BKException.Code.OK == rc) { - promise.updateIfEmpty(new Return<LedgerHandle>(lh)); + promise.complete(lh); } else { - promise.updateIfEmpty(new Throw<LedgerHandle>(BKException.create(rc))); + promise.completeExceptionally(BKException.create(rc)); } } }, null); return promise; } - public Future<Void> deleteLedger(long lid, + public CompletableFuture<Void> deleteLedger(long lid, final boolean ignoreNonExistentLedger) { --- End diff -- Please also do the code alignment change here.
--- 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. ---