kirktrue commented on code in PR #16124:
URL: https://github.com/apache/kafka/pull/16124#discussion_r1621332051


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManager.java:
##########
@@ -478,6 +478,23 @@ public void resetTimer() {
             this.heartbeatTimer.reset(heartbeatIntervalMs);
         }
 
+        @Override
+        public String toStringBase() {
+            return super.toStringBase() +
+                    ", heartbeatTimer=" + heartbeatTimer +
+                    ", heartbeatIntervalMs=" + heartbeatIntervalMs;
+        }
+
+        // Visible for testing
+        protected Timer heartbeatTimer() {
+            return this.heartbeatTimer;
+        }
+
+        // Visible for testing
+        protected long heartbeatIntervalMs() {
+            return this.heartbeatIntervalMs;

Review Comment:
   ```suggestion
               return heartbeatIntervalMs;
   ```



##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManagerTest.java:
##########
@@ -152,6 +152,34 @@ public void cleanup() {
         }
     }
 
+    @Test
+    public void testHeartBeatRequestStateToStringBase() {
+        final long retryBackoffMs = 100;
+        final long retryBackoffMaxMs = 1000;
+        LogContext logContext = new LogContext();
+        HeartbeatRequestState heartbeatRequestState1 = new 
HeartbeatRequestState(

Review Comment:
   Super nit: we can drop the `1` at the end of the variable name, right?
   
   ```suggestion
           HeartbeatRequestState heartbeatRequestState = new 
HeartbeatRequestState(
   ```



##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManager.java:
##########
@@ -478,6 +478,23 @@ public void resetTimer() {
             this.heartbeatTimer.reset(heartbeatIntervalMs);
         }
 
+        @Override
+        public String toStringBase() {
+            return super.toStringBase() +
+                    ", heartbeatTimer=" + heartbeatTimer +
+                    ", heartbeatIntervalMs=" + heartbeatIntervalMs;
+        }
+
+        // Visible for testing
+        protected Timer heartbeatTimer() {
+            return this.heartbeatTimer;

Review Comment:
   ```suggestion
               return heartbeatTimer;
   ```



##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManagerTest.java:
##########
@@ -152,6 +152,34 @@ public void cleanup() {
         }
     }
 
+    @Test
+    public void testHeartBeatRequestStateToStringBase() {
+        final long retryBackoffMs = 100;
+        final long retryBackoffMaxMs = 1000;
+        LogContext logContext = new LogContext();
+        HeartbeatRequestState heartbeatRequestState1 = new 
HeartbeatRequestState(
+                logContext,
+                time,
+                10,
+                retryBackoffMs,
+                retryBackoffMaxMs,
+                .2
+        );
+
+        RequestState requestState = new RequestState(
+                logContext,
+                
"org.apache.kafka.clients.consumer.internals.HeartbeatRequestManager$HeartbeatRequestState",

Review Comment:
   Perhaps we could make `HeartbeatRequestState` package-protected, then we 
could do this:
   
   ```suggestion
                   
HeartbeatRequestManager.HeartbeatRequestState.class.getName(),
   ```



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