You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/10/05 19:58:13 UTC

[GitHub] [bookkeeper] StevenLuMT commented on a diff in pull request #3513: LedgerOpenOp: Do not call blocking close() in the callback

StevenLuMT commented on code in PR #3513:
URL: https://github.com/apache/bookkeeper/pull/3513#discussion_r985339472


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java:
##########
@@ -208,10 +204,13 @@ public void safeOperationComplete(int rc, Void result) {
                     if (rc == BKException.Code.OK) {
                         openComplete(BKException.Code.OK, lh);
                     } else if (rc == BKException.Code.UnauthorizedAccessException) {
-                        closeLedgerHandle();
-                        openComplete(BKException.Code.UnauthorizedAccessException, null);
+                        closeLedgerHandleAsync().whenComplete((r, ex) -> {
+                            if (ex != null) {
+                                log.error("Ledger {} close failed", ledgerId, ex);

Review Comment:
   change replace log to LOG
   `LOG.error("Ledger {} close failed", ledgerId, ex);`



##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java:
##########
@@ -208,10 +204,13 @@ public void safeOperationComplete(int rc, Void result) {
                     if (rc == BKException.Code.OK) {
                         openComplete(BKException.Code.OK, lh);
                     } else if (rc == BKException.Code.UnauthorizedAccessException) {
-                        closeLedgerHandle();
-                        openComplete(BKException.Code.UnauthorizedAccessException, null);
+                        closeLedgerHandleAsync().whenComplete((r, ex) -> {
+                            if (ex != null) {
+                                log.error("Ledger {} close failed", ledgerId, ex);

Review Comment:
   change replace log to LOG ,like this:
   `LOG.error("Ledger {} close failed", ledgerId, ex);`



##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java:
##########
@@ -226,8 +225,12 @@ public String toString() {
                 public void readLastConfirmedComplete(int rc,
                         long lastConfirmed, Object ctx) {
                     if (rc != BKException.Code.OK) {
-                        closeLedgerHandle();
-                        openComplete(bk.getReturnRc(BKException.Code.ReadException), null);
+                        closeLedgerHandleAsync().whenComplete((r, ex) -> {
+                            if (ex != null) {
+                                log.error("Ledger {} close failed", ledgerId, ex);

Review Comment:
   change replace log to LOG ,like this:
   `LOG.error("Ledger {} close failed", ledgerId, ex);`



-- 
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: commits-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org