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



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/processor/internals/StandbyTask.java
##########
@@ -112,10 +112,19 @@ public void completeRestoration() {
     @Override
     public void suspend() {
         log.trace("No-op suspend with state {}", state());
-        if (state() == State.RUNNING) {
-            transitionTo(State.SUSPENDED);
-        } else if (state() == State.RESTORING) {
-            throw new IllegalStateException("Illegal state " + state() + " 
while suspending standby task " + id);
+        switch (state()) {
+            case CREATED:
+            case RUNNING:
+            case SUSPENDED:
+                transitionTo(State.SUSPENDED);
+                break;
+
+            case RESTORING:

Review comment:
       I agree 100%, but at some point in the past we started checking for 
`RESTORING` and throwing IllegalStateException all over StandbyTask. I wanted 
to keep the changes here to a minimum and figured we should at least be 
consistent with the current pattern elsewhere




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