Skip to content

Commit 45515e9

Browse files
Reset Error reason after ConcurrentContainer is stopped
Error reason is not cleared after the `ConcurrentContainer` is stopped. It is cleared only when the `Reason` is `Auth`. This could be problematic if container is again started.
1 parent 49b6c37 commit 45515e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

spring-kafka/src/main/java/org/springframework/kafka/listener/ConcurrentMessageListenerContainer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,11 @@ public void childStopped(MessageListenerContainer child, Reason reason) {
390390
int startedContainersCount = this.startedContainers.decrementAndGet();
391391
if (startedContainersCount == 0) {
392392
publishConcurrentContainerStoppedEvent(this.reason);
393-
if (Reason.AUTH.equals(this.reason)
394-
&& getContainerProperties().isRestartAfterAuthExceptions()) {
395-
396-
this.reason = null;
393+
boolean restartContainer = Reason.AUTH.equals(this.reason)
394+
&& getContainerProperties().isRestartAfterAuthExceptions();
395+
this.reason = null;
397396

397+
if (restartContainer) {
398398
// This has to run on another thread to avoid a deadlock on lifecycleMonitor
399399
AsyncTaskExecutor exec = getContainerProperties().getListenerTaskExecutor();
400400
if (exec == null) {

0 commit comments

Comments
 (0)