vvcephei commented on a change in pull request #9697: URL: https://github.com/apache/kafka/pull/9697#discussion_r539615678
########## File path: streams/src/test/java/org/apache/kafka/streams/integration/StreamsUncaughtExceptionHandlerIntegrationTest.java ########## @@ -202,6 +213,28 @@ private void testShutdownApplication(final int numThreads) throws InterruptedExc assertThat(processorValueCollector.size(), equalTo(1)); } } + + private void testReplaceThreads(final int numThreads) throws InterruptedException { + properties.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, numThreads); + try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), properties)) { + kafkaStreams.setUncaughtExceptionHandler((t, e) -> fail("should not hit old handler")); + + final AtomicInteger count = new AtomicInteger(); + kafkaStreams.setUncaughtExceptionHandler(exception -> { + count.getAndIncrement(); + if (count.get() > 2) { + return SHUTDOWN_CLIENT; + } + return REPLACE_THREAD; + }); + StreamsTestUtils.startKafkaStreamsAndWaitForRunningState(kafkaStreams); + + produceMessages(0L, inputTopic, "A"); + waitForApplicationState(Collections.singletonList(kafkaStreams), KafkaStreams.State.NOT_RUNNING, DEFAULT_DURATION); + + assertThat(processorValueCollector.size(), equalTo(3)); Review comment: It's not obvious to me how this verifies that the thread actually got replaced. Maybe an explanatory comment is in order? ---------------------------------------------------------------- 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