@Override
        public void run() {
            ProcessResult result = new ProcessResult();
            StringBuilder strBuffer = new StringBuilder(512);
            try {
                clientRmtDataCache.resumeTimeoutConsumePartitions(false,
                        consumerConfig.getPullProtectConfirmTimeoutMs());
                // print metric information
                clientStatsInfo.selfPrintStatsInfo(false, true, strBuffer);
                // Send heartbeat request to master
                ClientMaster.HeartResponseM2CV2 response =
                        masterService.consumerHeartbeatC2MV2(createMasterHeartBeatRequest(),
                                AddressUtils.getLocalAddress(), consumerConfig.isTlsEnable());
                // Process unsuccessful response
                if (response == null) {
                    clientStatsInfo.bookHB2MasterTimeout();
                    logger.warn(strBuffer.append("[Heartbeat Failed] ")
                            .append("return result is null!").toString());
                    strBuffer.delete(0, strBuffer.length());
                    heartbeat2MRetryTimes++;
                    return;
                }
                if (response.getErrCode() != TErrCodeConstants.SUCCESS) {
                    // If master replies that cannot find current consumer node, re-register
                    if (response.getErrCode() == TErrCodeConstants.HB_NO_NODE) {
                        clientStatsInfo.bookHB2MasterTimeout();
                        if (tryRegister2Master(result, strBuffer)) {
                            logger.info(strBuffer.append("[Re-register] ")
                                    .append(consumerId).toString());
                            strBuffer.delete(0, strBuffer.length());
                        } else {
                            logger.info(result.getErrMsg());
                        }
                        return;
                    }
                    clientStatsInfo.bookHB2MasterException();
                    logger.error(strBuffer.append("[Heartbeat Failed] ")
                            .append(response.getErrMsg()).toString());
                    if (response.getErrCode() == TErrCodeConstants.CERTIFICATE_FAILURE) {
                        adjustHeartBeatPeriod("certificate failure", strBuffer);
                    } else {
                        heartbeat2MRetryTimes++;
                    }
                    return;
                }
                // Process the heartbeat success response
                heartbeat2MRetryTimes = 0;
                clientRmtDataCache.updateBrokerInfoList(
                        response.getBrokerConfigId(),
                        response.getBrokerConfigListList(), strBuffer);
                if (response.hasTopicMetaInfoId()) {
                    // update local cache meta information
                    needMetaSelfChk.compareAndSet(false, true);
                    clientRmtDataCache.storeTopicMetaInfo(response.getTopicMetaInfoId(),
                            response.getTopicMetaInfoListList());
                    lstMetaQueryTime.set(System.currentTimeMillis());
                }
                // Get the authorization rules and update the local rules
                clientRmtDataCache.updOpsTaskInfo(response.getOpsTaskInfo(), strBuffer);
                // Get the latest authorized token
                processHeartBeatAuthorizedToken(response);
                // Warning if heartbeat interval is too long
                long currentTime = System.currentTimeMillis();
                if ((currentTime - lastHeartbeatTime2Master) > consumerConfig.getHeartbeatPeriodMs() * 2) {
                    logger.warn(strBuffer.append(consumerId)
                            .append(" heartbeat interval to master is too long,please check! Total time : ")
                            .append(currentTime - lastHeartbeatTime2Master).toString());
                    strBuffer.delete(0, strBuffer.length());
                }
                lastHeartbeatTime2Master = currentTime;
            } catch (InterruptedException ee) {
                logger.info("To Master Heartbeat thread is interrupted,existed!");
            } catch (Throwable e) {
                // Print the log when meeting heartbeat errors.
                // Reduce the heartbeat request frequency when failure count exceed the threshold
                if (!isShutdown()) {
                    samplePrintCtrl.printExceptionCaught(e);
                }
                adjustHeartBeatPeriod("heartbeat exception", strBuffer);
            }
        }
Start heartbeat thread threads.

@param result  process result
@param sBuffer  string buffer

@return  process result
inlong-tubemq/tubemq-client/src/main/java/org/apache/inlong/tubemq/client/consumer/SimpleClientBalanceConsumer.java