Copilot commented on code in PR #16620:
URL: https://github.com/apache/pinot/pull/16620#discussion_r2280077474


##########
pinot-plugins/pinot-stream-ingestion/pinot-kafka-3.0/src/main/java/org/apache/pinot/plugin/stream/kafka30/KafkaStreamMetadataProvider.java:
##########
@@ -172,7 +172,8 @@ public Map<String, PartitionLagState> 
getCurrentPartitionLagState(
 
   @Override
   public List<TopicMetadata> getTopics() {
-    try (AdminClient adminClient = createAdminClient()) {
+    try {
+      AdminClient adminClient = getOrCreateAdminClient();

Review Comment:
   The removal of try-with-resources pattern without proper exception handling 
could lead to resource leaks. The AdminClient is now reused and not 
automatically closed, but if an exception occurs in the try block, the method 
will exit without proper cleanup. Consider adding exception handling or 
ensuring the admin client is properly managed.
   ```suggestion
       AdminClient adminClient = null;
       try {
         adminClient = getOrCreateAdminClient();
   ```



##########
pinot-plugins/pinot-stream-ingestion/pinot-kafka-2.0/src/main/java/org/apache/pinot/plugin/stream/kafka20/KafkaStreamMetadataProvider.java:
##########
@@ -172,7 +172,8 @@ public Map<String, PartitionLagState> 
getCurrentPartitionLagState(
 
   @Override
   public List<TopicMetadata> getTopics() {
-    try (AdminClient adminClient = createAdminClient()) {
+    try {

Review Comment:
   The removal of try-with-resources pattern without proper exception handling 
could lead to resource leaks. The AdminClient is now reused and not 
automatically closed, but if an exception occurs in the try block, the method 
will exit without proper cleanup. Consider adding exception handling or 
ensuring the admin client is properly managed.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to