Skip to content

Commit

Permalink
Future completed twice in the method of impl.MLPendingAckStore#closeA…
Browse files Browse the repository at this point in the history
…sync (#12362)

(cherry picked from commit 10371ee)
  • Loading branch information
lordcheng10 authored and codelipenghui committed Dec 20, 2021
1 parent bc50bac commit 86681ae
Showing 1 changed file with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,23 @@ public CompletableFuture<Void> closeAsync() {
cursor.asyncClose(new AsyncCallbacks.CloseCallback() {
@Override
public void closeComplete(Object ctx) {
try {
managedLedger.close();
} catch (Exception e) {
completableFuture.completeExceptionally(e);
}
completableFuture.complete(null);
managedLedger.asyncClose(new AsyncCallbacks.CloseCallback() {

@Override
public void closeComplete(Object ctx) {
if (log.isDebugEnabled()) {
log.debug("[{}][{}] MLPendingAckStore closed successfully!", managedLedger.getName(), ctx);
}
completableFuture.complete(null);
}

@Override
public void closeFailed(ManagedLedgerException exception, Object ctx) {
log.error("[{}][{}] MLPendingAckStore closed failed,exception={}", managedLedger.getName(),
ctx, exception);
completableFuture.completeExceptionally(exception);
}
}, ctx);
}

@Override
Expand Down

0 comments on commit 86681ae

Please sign in to comment.