mjsax commented on code in PR #19669:
URL: https://github.com/apache/kafka/pull/19669#discussion_r2083381111


##########
clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java:
##########
@@ -1959,17 +1963,19 @@ public void testCloseShouldBeIdempotent(GroupProtocol 
groupProtocol) {
 
         consumer = newConsumer(groupProtocol, time, client, subscription, 
metadata, assignor, false, groupInstanceId);
 
-        consumer.close(Duration.ZERO);
-        consumer.close(Duration.ZERO);
+        consumer.close(CloseOptions.timeout(Duration.ZERO));
+        consumer.close(CloseOptions.timeout(Duration.ZERO));
 
         // verify that the call is idempotent by checking that the network 
client is only closed once.
         verify(client).close();
     }
 
+    @SuppressWarnings("resource")

Review Comment:
   Well, gradle does not warn, but IntelliJ.
   
   `newConsumer(...)` returns a `Consumer` which is auto-closable -- the old 
code did use try-with-resource (so there was no warning), but had another 
warning "unused variable `consumer`" -- given that we expect `newConsumer(...)` 
to throw, I thought it's better to remove try-with-resource and `consumer` 
variable.
   
   Thoughts?



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