ableegoldman commented on a change in pull request #10597:
URL: https://github.com/apache/kafka/pull/10597#discussion_r624155311



##########
File path: streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java
##########
@@ -343,10 +344,16 @@ private boolean isRunningOrRebalancing() {
     }
 
     private void validateIsRunningOrRebalancing() {
-        if (!isRunningOrRebalancing()) {
-            throw new IllegalStateException("KafkaStreams is not running. 
State is " + state + ".");
+        synchronized (stateLock) {
+            if (state == State.CREATED) {
+                throw new StreamsNotStartedException("KafkaStreams is not 
started, you can retry and wait until to running.");

Review comment:
       ```suggestion
                   throw new StreamsNotStartedException("KafkaStreams has not 
been started, you can retry after calling start()");
   ```
   I recommend avoiding using the term "running" here, since that has a 
specific meaning (ie, it implies you need to wait for the state to be RUNNING, 
which is not true here). We do tend to use the term running quite loosely in 
the code to sometimes refer to both running+rebalancing, but let's make this as 
clear as possible since it's user facing. It's bad enough that as devs you have 
to go to the method implementation to see if `isRunning` means literally just 
running, or if it also includes rebalancing state(s) 🙂 




-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to