Use asyncCloseCursorLedger to replace cursorLedger.asyncClose method in the ManagedCursorImpl.VoidCallback#operationComplete
The org.apache.bookkeeper.mledger.impl.ManagedCursorImpl#asyncCloseCursorLedger method is an unused method, delete the redundant method
@@ -2235,18 +2235,7 @@ public class ManagedCursorImpl implements ManagedCursor {
public void operationComplete() {
log.info("[{}][{}] Updated md-position={} into cursor-ledger {}", ledger.getName(), name,
markDeletePosition, cursorLedger.getId());
- cursorLedger.asyncClose((rc, lh, ctx1) -> {
- callback.closeComplete(ctx);
-
- if (rc == BKException.Code.OK) {
- log.info("[{}][{}] Closed cursor-ledger {}", ledger.getName(), name,
- cursorLedger.getId());
- } else {
- log.warn("[{}][{}] Failed to close cursor-ledger {}: {}", ledger.getName(), name,
- cursorLedger.getId(), BKException.getMessage(rc));
- }
- }, ctx);
-
+ asyncCloseCursorLedger(callback, ctx);
}
@Override
@@ -2733,8 +2722,12 @@ public class ManagedCursorImpl implements ManagedCursor {
public void closeComplete(int rc, LedgerHandle lh, Object ctx) {
ledger.mbean.endCursorLedgerCloseOp();
if (rc == BKException.Code.OK) {
+ log.info("[{}][{}] Closed cursor-ledger {}", ledger.getName(), name,
+ cursorLedger.getId());
callback.closeComplete(ctx);
} else {
+ log.warn("[{}][{}] Failed to close cursor-ledger {}: {}", ledger.getName(), name,
+ cursorLedger.getId(), BKException.getMessage(rc));
callback.closeFailed(createManagedLedgerException(rc), ctx);
}
}
