Skip to content

Commit

Permalink
GH-2724: Fix RabbitFuture for interrupted thread
Browse files Browse the repository at this point in the history
Fixes: #2724

(cherry picked from commit ec35739)
  • Loading branch information
artembilan authored and spring-builds committed May 29, 2024
1 parent 6c864bb commit beada3b
Showing 1 changed file with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,33 @@ Message getRequestMessage() {

@Override
public boolean complete(T value) {
cancelTimeoutTaskIfAny();
return super.complete(value);
try {
return super.complete(value);
}
finally {
cancelTimeoutTaskIfAny();
}
}

@Override
public boolean completeExceptionally(Throwable ex) {
cancelTimeoutTaskIfAny();
return super.completeExceptionally(ex);
try {
return super.completeExceptionally(ex);
}
finally {
cancelTimeoutTaskIfAny();
}
}

@Override
public boolean cancel(boolean mayInterruptIfRunning) {
cancelTimeoutTaskIfAny();
this.canceler.accept(this.correlationId, this.channelHolder);
return super.cancel(mayInterruptIfRunning);
try {
return super.cancel(mayInterruptIfRunning);
}
finally {
cancelTimeoutTaskIfAny();
}
}

private void cancelTimeoutTaskIfAny() {
Expand Down

0 comments on commit beada3b

Please sign in to comment.