ivankelly commented on a change in pull request #1809: Change LedgerManager to 
use CompletableFuture
URL: https://github.com/apache/bookkeeper/pull/1809#discussion_r234229005
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeperAdmin.java
 ##########
 @@ -491,26 +489,24 @@ public void asyncGetLedgersContainBookies(final 
Set<BookieSocketAddress> bookies
         bkc.getLedgerManager().asyncProcessLedgers(new Processor<Long>() {
             @Override
             public void process(final Long lid, final 
AsyncCallback.VoidCallback cb) {
-                bkc.getLedgerManager().readLedgerMetadata(lid, new 
GenericCallback<Versioned<LedgerMetadata>>() {
-                    @Override
-                    public void operationComplete(int rc, 
Versioned<LedgerMetadata> metadata) {
-                        if (BKException.Code.NoSuchLedgerExistsException == 
rc) {
-                            // the ledger was deleted during this iteration.
-                            cb.processResult(BKException.Code.OK, null, null);
-                            return;
-                        } else if (BKException.Code.OK != rc) {
-                            cb.processResult(rc, null, null);
-                            return;
-                        }
-                        Set<BookieSocketAddress> bookiesInLedger = 
metadata.getValue().getBookiesInThisLedger();
-                        Sets.SetView<BookieSocketAddress> intersection =
+                bkc.getLedgerManager().readLedgerMetadata(lid)
+                    .whenComplete((metadata, exception) -> {
+                            if (exception instanceof 
BKException.BKNoSuchLedgerExistsException) {
 
 Review comment:
   No, shouldn't be, but it's dependent on how readLedgerMetadata is 
implemented, so will change to getCode

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to