cadonna commented on code in PR #12465:
URL: https://github.com/apache/kafka/pull/12465#discussion_r984445451


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java:
##########
@@ -1146,6 +1146,10 @@ private long advanceNowAndComputeLatency() {
     public void shutdown() {
         log.info("Informed to shut down");
         final State oldState = setState(State.PENDING_SHUTDOWN);
+
+        // If the thread is already shutting down, this is a No-op.
+        if (oldState == State.PENDING_SHUTDOWN || oldState == State.DEAD) 
return;

Review Comment:
   I think the condition is never true. Method `setState()` will return `null` 
if the current state is either `PENDING_SHUTDOWN` 
(https://github.com/divijvaidya/kafka/blob/1780a0c4676f212b1271688248383420e754718f/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java#L224)
  or `DEAD` 
(https://github.com/divijvaidya/kafka/blob/1780a0c4676f212b1271688248383420e754718f/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java#L230).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to