lianetm commented on code in PR #16449:
URL: https://github.com/apache/kafka/pull/16449#discussion_r1670689743


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java:
##########
@@ -1499,14 +1499,16 @@ public void unsubscribe() {
         }
     }
 
-    private void resetGroupMetadata() {
-        groupMetadata.updateAndGet(
-            oldGroupMetadataOptional -> oldGroupMetadataOptional
-                .map(oldGroupMetadata -> initializeConsumerGroupMetadata(
-                    oldGroupMetadata.groupId(),
-                    oldGroupMetadata.groupInstanceId()
-                ))
-        );
+    private void maybeResetGroupMetadata() {
+        if (groupMetadata.get().isPresent()) {

Review Comment:
   We do want this semantics, but I would say we don't need the check because 
we already get it from the `.map` call on the Optional right below (it will 
only map if there is a value)



##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java:
##########
@@ -1499,14 +1499,16 @@ public void unsubscribe() {
         }
     }
 
-    private void resetGroupMetadata() {
-        groupMetadata.updateAndGet(
-            oldGroupMetadataOptional -> oldGroupMetadataOptional
-                .map(oldGroupMetadata -> initializeConsumerGroupMetadata(
-                    oldGroupMetadata.groupId(),
-                    oldGroupMetadata.groupInstanceId()
-                ))
-        );
+    private void maybeResetGroupMetadata() {
+        if (groupMetadata.get().isPresent()) {

Review Comment:
   We do want this semantic, but I would say we don't need the check because we 
already get it from the `.map` call on the Optional right below (it will only 
map if there is a value)



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