Skip to content

Commit f8f256c

Browse files
authored
[fix][broker] Continue closing even when executor is shut down (apache#22599)
1 parent f411e3c commit f8f256c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import java.util.concurrent.CompletionException;
4646
import java.util.concurrent.ExecutionException;
4747
import java.util.concurrent.ExecutorService;
48+
import java.util.concurrent.RejectedExecutionException;
4849
import java.util.concurrent.ScheduledFuture;
4950
import java.util.concurrent.TimeUnit;
5051
import java.util.concurrent.atomic.AtomicBoolean;
@@ -1429,7 +1430,14 @@ private CompletableFuture<Void> delete(boolean failIfHasSubscriptions,
14291430
}
14301431
FutureUtil.waitForAll(futures).thenRunAsync(() -> {
14311432
closeClientFuture.complete(null);
1432-
}, getOrderedExecutor()).exceptionally(ex -> {
1433+
}, command -> {
1434+
try {
1435+
getOrderedExecutor().execute(command);
1436+
} catch (RejectedExecutionException e) {
1437+
// executor has been shut down, execute in current thread
1438+
command.run();
1439+
}
1440+
}).exceptionally(ex -> {
14331441
log.error("[{}] Error closing clients", topic, ex);
14341442
unfenceTopicToResume();
14351443
closeClientFuture.completeExceptionally(ex);

0 commit comments

Comments
 (0)