merlimat commented on code in PR #4881:
URL: https://github.com/apache/bookkeeper/pull/4881#discussion_r3980400145


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java:
##########
@@ -310,6 +292,57 @@ public void readLastConfirmedComplete(int rc,
         }
     }
 
+    /**
+     * Callback completing the open once recovery is done, run on the handle's 
thread. Without an ordering key
+     * this is the ledger-id keyed {@link OrderedGenericCallback}; with one, 
the completion is submitted to the
+     * handle's executor, which is the thread selected by that key.
+     */
+    private GenericCallback<Void> recoveryCallback(boolean watchImmediately) {
+        if (orderingKey == null) {
+            return new OrderedGenericCallback<Void>(bk.getMainWorkerPool(), 
ledgerId) {
+                @Override
+                public void safeOperationComplete(int rc, Void result) {
+                    recoveryComplete(rc, watchImmediately);
+                }
+
+                @Override
+                public String toString() {
+                    return String.format("Recover(%d)", ledgerId);
+                }
+            };
+        }
+        return (rc, result) -> {
+            try {
+                lh.executeOrdered(() -> recoveryComplete(rc, 
watchImmediately));
+            } catch (RejectedExecutionException ree) {
+                log.warn().exception(ree).log("Failed to submit recovery 
completion callback");
+            }
+        };
+    }
+

Review Comment:
   This is matching the `OrderedGenericCallback` behavior and it only happens 
when the bk client is shutting down. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to