lianetm commented on code in PR #18945: URL: https://github.com/apache/kafka/pull/18945#discussion_r1971704382
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java: ########## @@ -165,16 +165,18 @@ public AbstractCoordinator(GroupRebalanceConfig rebalanceConfig, Metrics metrics, String metricGrpPrefix, Time time) { - this(rebalanceConfig, logContext, client, metrics, metricGrpPrefix, time, Optional.empty()); + this(rebalanceConfig, logContext, client, metrics, metricGrpPrefix, time, Optional.empty(), Optional.empty()); } + @SuppressWarnings("this-escape") Review Comment: I guess we could we avoid suppressing here if we fix how we create the `HeartbeatThread::new` in this constructor? (ex. we could do it lazily on `startHeartbeatThreadIfNeeded`, and just keep an Optional ref to the supplier here) ########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/BaseHeartbeatThread.java: ########## @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.kafka.clients.consumer.internals; + +import org.apache.kafka.common.utils.KafkaThread; + +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; + +/** + * Base class for heartbeat threads. This class provides a mechanism to enable/disable the heartbeat thread. + * The heartbeat thread should check whether it's enabled by calling {@link BaseHeartbeatThread#isEnabled()} + * before sending heartbeat requests. + */ +public class BaseHeartbeatThread extends KafkaThread implements AutoCloseable { Review Comment: should we add a basic unit test for this class (simple test just to make sure that the all actions flip the right flag, ex. isEnabled() true after calling enable(), etc.) -- 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