lhotari commented on code in PR #21333:
URL: https://github.com/apache/pulsar/pull/21333#discussion_r1354292433


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -2685,32 +2685,47 @@ public void operationComplete(Void result, Stat stat) {
                     }
 
                     @Override
-                    public void operationFailed(MetaStoreException e) {
-                        if (e instanceof 
MetaStoreException.BadVersionException) {
+                    public void operationFailed(MetaStoreException 
topLevelException) {
+                        if (topLevelException instanceof 
MetaStoreException.BadVersionException) {
                             log.warn("[{}] Failed to update cursor metadata 
for {} due to version conflict {}",
-                                    ledger.name, name, e.getMessage());
+                                    ledger.name, name, 
topLevelException.getMessage());
                             // it means previous owner of the ml might have 
updated the version incorrectly. So, check
                             // the ownership and refresh the version again.
-                            if (ledger.mlOwnershipChecker != null && 
ledger.mlOwnershipChecker.get()) {
-                                
ledger.getStore().asyncGetCursorInfo(ledger.getName(), name,
-                                        new 
MetaStoreCallback<ManagedCursorInfo>() {
-                                            @Override
-                                            public void 
operationComplete(ManagedCursorInfo info, Stat stat) {
-                                                updateCursorLedgerStat(info, 
stat);
-                                            }
-
-                                            @Override
-                                            public void 
operationFailed(MetaStoreException e) {
-                                                if (log.isDebugEnabled()) {
-                                                    log.debug(
-                                                            "[{}] Failed to 
refresh cursor metadata-version for {} due "
-                                                            + "to {}", 
ledger.name, name, e.getMessage());
-                                                }
-                                            }
-                                        });
+                            if (ledger.mlOwnershipChecker != null) {
+                                
ledger.mlOwnershipChecker.get().whenComplete((hasOwnership, t) -> {

Review Comment:
   The same requirement about non-null return value has existed before this PR.



-- 
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