Skip to content

Commit

Permalink
[fix][broker] Continue closing even when executor is shut down (#22599)
Browse files Browse the repository at this point in the history
(cherry picked from commit f8f256c)
  • Loading branch information
lhotari committed Nov 23, 2024
1 parent bb909e6 commit e2bd423
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
Expand Down Expand Up @@ -1452,7 +1453,14 @@ private CompletableFuture<Void> delete(boolean failIfHasSubscriptions,
}
FutureUtil.waitForAll(futures).thenRunAsync(() -> {
closeClientFuture.complete(null);
}, getOrderedExecutor()).exceptionally(ex -> {
}, command -> {
try {
getOrderedExecutor().execute(command);
} catch (RejectedExecutionException e) {
// executor has been shut down, execute in current thread
command.run();
}
}).exceptionally(ex -> {
log.error("[{}] Error closing clients", topic, ex);
alreadyUnFenced.set(true);
unfenceTopicToResume();
Expand Down

0 comments on commit e2bd423

Please sign in to comment.