showuon commented on a change in pull request #11123:
URL: https://github.com/apache/kafka/pull/11123#discussion_r675962656



##########
File path: streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java
##########
@@ -386,23 +405,23 @@ public void setStateListener(final 
KafkaStreams.StateListener listener) {
      * terminates due to an uncaught exception.
      *
      * @param uncaughtExceptionHandler the uncaught exception handler for all 
internal threads; {@code null} deletes the current handler
-     * @throws IllegalStateException if this {@code KafkaStreams} instance is 
not in state {@link State#CREATED CREATED}.
+     * @throws IllegalStateException if this {@code KafkaStreams} instance has 
already been started.
      *
      * @deprecated Since 2.8.0. Use {@link 
KafkaStreams#setUncaughtExceptionHandler(StreamsUncaughtExceptionHandler)} 
instead.
      *
      */
     @Deprecated
     public void setUncaughtExceptionHandler(final 
Thread.UncaughtExceptionHandler uncaughtExceptionHandler) {
         synchronized (stateLock) {
-            if (state == State.CREATED) {
+            if (state.hasNotStarted()) {
                 oldHandler = true;
                 processStreamThread(thread -> 
thread.setUncaughtExceptionHandler(uncaughtExceptionHandler));
 
                 if (globalStreamThread != null) {
                     
globalStreamThread.setUncaughtExceptionHandler(uncaughtExceptionHandler);
                 }
             } else {
-                throw new IllegalStateException("Can only set 
UncaughtExceptionHandler in CREATED state. " +
+                throw new IllegalStateException("Can only set 
UncaughtExceptionHandler before calling start(). " +

Review comment:
       Agree!

##########
File path: streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java
##########
@@ -1562,8 +1581,8 @@ public void cleanUp() {
      *
      * @param storeQueryParameters   the parameters used to fetch a queryable 
store
      * @return A facade wrapping the local {@link StateStore} instances
-     * @throws StreamsNotStartedException If Streams state is {@link 
KafkaStreams.State#CREATED CREATED}. Just
-     *         retry and wait until to {@link KafkaStreams.State#RUNNING 
RUNNING}.
+     * @throws StreamsNotStartedException If Streams has not yet been started. 
Just call {@link KafkaStreams#start()}
+     *                                    and then retry this call.

Review comment:
       Nice catch! We actually allow `REBALANCING` and `RUNNING` state in this 
method.  




-- 
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: jira-unsubscr...@kafka.apache.org

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


Reply via email to