AndrewJSchofield commented on code in PR #15803:
URL: https://github.com/apache/kafka/pull/15803#discussion_r1587067096


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchBuffer.java:
##########
@@ -173,15 +173,23 @@ void awaitNotEmpty(Timer timer) {
                 // Update the timer before we head into the loop in case it 
took a while to get the lock.
                 timer.update();
 
-                if (timer.isExpired())
+                if (timer.isExpired()) {
+                    // If the thread was interrupted before we start waiting, 
it still counts as
+                    // interrupted from the point of view of the 
KafkaConsumer.poll(Duration) contract.
+                    // We only need to check this when we are not going to 
wait because waiting
+                    // already checks whether the thread is interrupted.
+                    if (Thread.interrupted())
+                        throw new InterruptException("Thread interrupted.");

Review Comment:
   OK. Done.



-- 
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