abhishekgiri23 commented on code in PR #16988:
URL: https://github.com/apache/kafka/pull/16988#discussion_r1756554180


##########
streams/src/test/java/org/apache/kafka/streams/integration/QueryableStateIntegrationTest.java:
##########
@@ -1085,77 +1086,72 @@ public void shouldAllowToQueryAfterThreadDied() throws 
Exception {
         final StreamsBuilder builder = new StreamsBuilder();
         final KStream<String, String> input = builder.stream(streamOne);
         input
-            .groupByKey()
-            .reduce((value1, value2) -> {
-                if (value1.length() > 1) {
-                    if (beforeFailure.compareAndSet(true, false)) {
-                        throw new RuntimeException("Injected test exception");
+                .groupByKey()
+                .reduce((value1, value2) -> {
+                    if (value1.length() > 1) {
+                        if (beforeFailure.compareAndSet(true, false)) {
+                            throw new RuntimeException("Injected test 
exception");
+                        }
                     }
-                }
-                return value1 + value2;
-            }, Materialized.as(storeName))
-            .toStream()
-            .to(outputTopic);
+                    return value1 + value2;
+                }, Materialized.as(storeName))
+                .toStream()
+                .to(outputTopic);
 
         streamsConfiguration.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, 2);
         kafkaStreams = new KafkaStreams(builder.build(), streamsConfiguration);
-        kafkaStreams.setUncaughtExceptionHandler((t, e) -> failed.set(true));
+        kafkaStreams.setUncaughtExceptionHandler(exception -> REPLACE_THREAD);
 
         startApplicationAndWaitUntilRunning(kafkaStreams);
 
         IntegrationTestUtils.produceKeyValuesSynchronously(
-            streamOne,
-            Arrays.asList(
-                KeyValue.pair("a", "1"),
-                KeyValue.pair("a", "2"),
-                KeyValue.pair("b", "3"),
-                KeyValue.pair("b", "4")),
-            TestUtils.producerConfig(
-                CLUSTER.bootstrapServers(),
-                StringSerializer.class,
-                StringSerializer.class,
-                new Properties()),
-            mockTime);
+                streamOne,
+                Arrays.asList(
+                        KeyValue.pair("a", "1"),
+                        KeyValue.pair("a", "2"),
+                        KeyValue.pair("b", "3"),
+                        KeyValue.pair("b", "4")),
+                TestUtils.producerConfig(
+                        CLUSTER.bootstrapServers(),
+                        StringSerializer.class,
+                        StringSerializer.class,
+                        new Properties()),
+                mockTime);
 
         final int maxWaitMs = 30000;
 
         final ReadOnlyKeyValueStore<String, String> store =
-            IntegrationTestUtils.getStore(storeName, kafkaStreams, 
keyValueStore());
+                IntegrationTestUtils.getStore(storeName, kafkaStreams, 
keyValueStore());
 
         TestUtils.waitForCondition(
-            () -> "12".equals(store.get("a")) && "34".equals(store.get("b")),
-            maxWaitMs,
-            "wait for agg to be <a,12> and <b,34>");
+                () -> "12".equals(store.get("a")) && 
"34".equals(store.get("b")),
+                maxWaitMs,
+                "wait for agg to be <a,12> and <b,34>");
 
         IntegrationTestUtils.produceKeyValuesSynchronously(
-            streamOne,
-            Collections.singleton(KeyValue.pair("a", "5")),
-            TestUtils.producerConfig(
-                CLUSTER.bootstrapServers(),
-                StringSerializer.class,
-                StringSerializer.class,
-                new Properties()),
-            mockTime);
-
-        TestUtils.waitForCondition(

Review Comment:
   I think we don't need this condition because in the old handler, we were 
setting the `failed` as true and now we are using a new handler checking the 
condition we are just replacing the thread.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to