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


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractHeartbeatRequestManager.java:
##########
@@ -18,90 +18,70 @@
 
 import org.apache.kafka.clients.CommonClientConfigs;
 import org.apache.kafka.clients.consumer.ConsumerConfig;
-import 
org.apache.kafka.clients.consumer.internals.AbstractMembershipManager.LocalAssignment;
 import 
org.apache.kafka.clients.consumer.internals.NetworkClientDelegate.PollResult;
 import 
org.apache.kafka.clients.consumer.internals.events.ApplicationEventProcessor;
 import 
org.apache.kafka.clients.consumer.internals.events.BackgroundEventHandler;
 import org.apache.kafka.clients.consumer.internals.events.ErrorEvent;
 import 
org.apache.kafka.clients.consumer.internals.metrics.HeartbeatMetricsManager;
-import org.apache.kafka.common.Uuid;
 import org.apache.kafka.common.errors.GroupAuthorizationException;
 import org.apache.kafka.common.errors.RetriableException;
-import org.apache.kafka.common.message.ConsumerGroupHeartbeatRequestData;
-import org.apache.kafka.common.metrics.Metrics;
+import org.apache.kafka.common.protocol.ApiMessage;
 import org.apache.kafka.common.protocol.Errors;
-import org.apache.kafka.common.requests.ConsumerGroupHeartbeatRequest;
-import org.apache.kafka.common.requests.ConsumerGroupHeartbeatResponse;
+import org.apache.kafka.common.requests.AbstractResponse;
 import org.apache.kafka.common.utils.LogContext;
 import org.apache.kafka.common.utils.Time;
 import org.apache.kafka.common.utils.Timer;
 
 import org.slf4j.Logger;
 
-import java.util.ArrayList;
 import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.stream.Collectors;
-
 
 /**
  * <p>Manages the request creation and response handling for the heartbeat. 
The module creates a
- * {@link ConsumerGroupHeartbeatRequest} using the state stored in the {@link 
ConsumerMembershipManager} and enqueue it to
- * the network queue to be sent out. Once the response is received, the module 
will update the state in the
- * {@link ConsumerMembershipManager} and handle any errors.</p>
+ * heartbeat request using the state stored in the membership manager and 
enqueues it to
+ * the network queue to be sent out. Once the response is received, it updates 
the state in the
+ * membership manager and handles any errors.
  *
  * <p>The manager will try to send a heartbeat when the member is in {@link 
MemberState#STABLE},
  * {@link MemberState#JOINING}, or {@link MemberState#RECONCILING}. Which mean 
the member is either in a stable
- * group, is trying to join a group, or is in the process of reconciling the 
assignment changes.</p>
+ * group, is trying to join a group, or is in the process of reconciling the 
assignment changes.
  *
- * <p>If the member got kick out of a group, it will try to give up the 
current assignment by invoking {@code
- * OnPartitionsLost} because reattempting to join again with a zero epoch.</p>
+ * <p>If the member got kicked out of a group, it will try to give up the 
current assignment by invoking {@code
+ * OnPartitionsLost} before attempting to join again with a zero epoch.
  *
- * <p>If the member does not have groupId configured or encountering fatal 
exceptions, a heartbeat will not be sent.</p>
+ * <p>If the member does not have groupId configured or encountering fatal 
exceptions, a heartbeat will not be sent.
  *
- * <p>If the coordinator not is not found, we will skip sending the heartbeat 
and try to find a coordinator first.</p>
+ * <p>If the coordinator not is not found, we will skip sending the heartbeat 
and try to find a coordinator first.
  *
- * <p>If the heartbeat failed due to retriable errors, such as, 
TimeoutException. The subsequent attempt will be
- * backoff exponentially.</p>
+ * <p>If the heartbeat failed due to retriable errors, such as 
TimeoutException, the subsequent attempt will be
+ * backed off exponentially.
  *
  * <p>When the member completes the assignment reconciliation, the {@link 
HeartbeatRequestState} will be reset so
- * that a heartbeat will be sent in the next event loop.</p>
+ * that a heartbeat will be sent in the next event loop.
  *
- * <p>See {@link HeartbeatRequestState} for more details.</p>
+ * <p>The class variable HBR is the response for the specific group's 
heartbeat RPC.
+ * <p>The class variable HRBD is the response data for the specific group's 
heartbeat RPC.
  */
-public class HeartbeatRequestManager implements RequestManager {
+public abstract class AbstractHeartbeatRequestManager<HBR extends 
AbstractResponse, HBRD extends ApiMessage> implements RequestManager {

Review Comment:
   Yeah, I'll try that. It's definitely good using names that don't look like 
full class names, so fully capitalized makes sense. Maybe R and D will work 
nicely. I'll give it a try.



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

Reply via email to