You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by yo...@apache.org on 2023/02/16 11:16:15 UTC

[bookkeeper] 21/33: Check client if closed when complete callback. (#3661)

This is an automated email from the ASF dual-hosted git repository.

yong pushed a commit to branch branch-4.15
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git

commit 773105e187e3a7ff25ddcabecf11830bb61195bd
Author: Qiang Zhao <ma...@apache.org>
AuthorDate: Thu Nov 24 10:53:12 2022 +0800

    Check client if closed when complete callback. (#3661)
    
    ### Motivation
    
    Follow the same rules to complete the callback to avoid Bookkeeper client operations being allowed even after its closure.
    
    ### Changes
    
    - Use `bk.getReturnRc(rc)` check the client state.
    
    (cherry picked from commit 221cba4ed32980e6e3109e9b9cca7e380b64ee65)
---
 .../src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java
index 847da0d89c..5cb15da2c7 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java
@@ -208,7 +208,7 @@ class LedgerOpenOp {
                             }
                             if (rc == BKException.Code.UnauthorizedAccessException
                                     || rc == BKException.Code.TimeoutException) {
-                                openComplete(rc, null);
+                                openComplete(bk.getReturnRc(rc), null);
                             } else {
                                 openComplete(bk.getReturnRc(BKException.Code.LedgerRecoveryException), null);
                             }