private void processBrokerHeatBeat(StringBuilder sBuffer) {
            List<String> partStrSet;
            List<Partition> partitions;
            List<String> strFailInfoList;
            for (BrokerInfo brokerInfo : clientRmtDataCache.getAllRegisterBrokers()) {
                if (isShutdown()) {
                    break;
                }
                partStrSet = new ArrayList<>();
                try {
                    // Handle the heartbeat response for partitions belong to the same broker.
                    partitions = clientRmtDataCache.getBrokerPartitionList(brokerInfo);
                    if ((partitions != null) && (!partitions.isEmpty())) {
                        for (Partition partition : partitions) {
                            partStrSet.add(partition.toString());
                        }
                        ClientBroker.HeartBeatResponseB2C response =
                                getBrokerService(brokerInfo).consumerHeartbeatC2B(
                                        createBrokerHeartBeatRequest(brokerInfo.getBrokerId(), partStrSet),
                                        AddressUtils.getLocalAddress(), consumerConfig.isTlsEnable());
                        if (response == null) {
                            clientStatsInfo.bookHB2BrokerTimeout();
                            continue;
                        }
                        if (response.getSuccess()) {
                            // store require authenticate information
                            clientRmtDataCache.bookBrokerRequireAuthInfo(
                                    brokerInfo.getBrokerId(), response);
                            // If the heartbeat response report failed partitions, release the
                            // corresponding local partition and log the operation
                            if (response.getHasPartFailure()) {
                                try {
                                    strFailInfoList = response.getFailureInfoList();
                                    for (String strFailInfo : strFailInfoList) {
                                        final int index =
                                                strFailInfo.indexOf(TokenConstants.ATTR_SEP);
                                        if (index < 0) {
                                            logger.error(sBuffer
                                                    .append("Parse Heartbeat response error : ")
                                                    .append("invalid response, ")
                                                    .append(strFailInfo).toString());
                                            sBuffer.delete(0, sBuffer.length());
                                            continue;
                                        }
                                        int errorCode =
                                                Integer.parseInt(strFailInfo.substring(0, index));
                                        Partition failPartition =
                                                new Partition(strFailInfo.substring(index + 1));
                                        clientRmtDataCache.removePartition(failPartition);
                                        logger.warn(sBuffer
                                                .append("[heart2broker error] partition:")
                                                .append(failPartition.toString())
                                                .append(", errorCode=")
                                                .append(errorCode).toString());
                                        sBuffer.delete(0, sBuffer.length());
                                    }
                                } catch (Throwable ee) {
                                    if (!isShutdown()) {
                                        sBuffer.delete(0, sBuffer.length());
                                        logger.error(sBuffer
                                                .append("Parse Heartbeat response error :")
                                                .append(ee.getMessage()).toString());
                                        sBuffer.delete(0, sBuffer.length());
                                    }
                                }
                            }
                        } else {
                            clientStatsInfo.bookHB2BrokerException();
                            if (response.getErrCode() == TErrCodeConstants.CERTIFICATE_FAILURE) {
                                for (Partition partition : partitions) {
                                    clientRmtDataCache.removePartition(partition);
                                }
                                logger.warn(sBuffer
                                        .append("[heart2broker error] certificate failure, ")
                                        .append(brokerInfo.getBrokerStrInfo())
                                        .append("'s partitions area released, ")
                                        .append(response.getErrMsg()).toString());
                                sBuffer.delete(0, sBuffer.length());
                            }
                        }
                    }
                } catch (Throwable ee) {
                    // If there's error in the heartbeat, collect the log and print out.
                    // Release the log string buffer.
                    if (!isShutdown()) {
                        samplePrintCtrl.printExceptionCaught(ee);
                        if (!partStrSet.isEmpty()) {
                            sBuffer.delete(0, sBuffer.length());
                            for (String partitionStr : partStrSet) {
                                Partition tmpPartition = new Partition(partitionStr);
                                clientRmtDataCache.removePartition(tmpPartition);
                                logger.warn(sBuffer
                                        .append("[heart2broker Throwable] release partition:")
                                        .append(partitionStr).toString());
                                sBuffer.delete(0, sBuffer.length());
                            }
                        }
                    }
                }
            }
        }
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