wcarlson5 commented on a change in pull request #9697: URL: https://github.com/apache/kafka/pull/9697#discussion_r536416836
########## File path: streams/src/test/java/org/apache/kafka/streams/integration/StreamsUncaughtExceptionHandlerIntegrationTest.java ########## @@ -145,6 +148,26 @@ public void shouldShutdownClient() throws InterruptedException { } } + @Test + public void shouldReplaceThread() throws InterruptedException { + try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), properties)) { + kafkaStreams.setUncaughtExceptionHandler((t, e) -> fail("should not hit old handler")); + AtomicInteger count = new AtomicInteger(); + kafkaStreams.setUncaughtExceptionHandler(exception -> { + count.getAndIncrement(); + return REPLACE_THREAD; + }); + + StreamsTestUtils.startKafkaStreamsAndWaitForRunningState(kafkaStreams); + + produceMessages(0L, inputTopic, "A"); + TestUtils.waitForCondition(() -> count.get() > 2, DEFAULT_TIMEOUT, "At least 3 threads have died"); Review comment: All of the original threads have died and been replaced and it is still running ---------------------------------------------------------------- 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