sunm2n commented on code in PR #24240:
URL: https://github.com/apache/kafka/pull/24240#discussion_r4607786538
##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/GlobalStreamThreadTest.java:
##########
@@ -325,6 +328,132 @@ public Set<TopicPartition> partitions() {
assertFalse(new File(baseDirectoryName + File.separator + "testAppId"
+ File.separator + "global").exists());
}
+ @Test
+ public void
shouldClearInterruptStatusBeforeInvokingUncaughtExceptionHandler() {
+ final AtomicBoolean interruptedInHandler = new AtomicBoolean(true);
+ initializeConsumer();
+ interruptOnNextPoll(mockConsumer);
+ globalStreamThread.setUncaughtExceptionHandler(
+ e ->
interruptedInHandler.set(Thread.currentThread().isInterrupted())
+ );
+
+ try {
+ globalStreamThread.run();
+ } finally {
+ // clear the interrupt status since this thread may be reused by
JUnit
+ Thread.interrupted();
Review Comment:
Done, an `@AfterEach` clears the status and the six `try/finally` blocks are
gone.
--
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]