@Override
        public void run() {
            StringBuilder strBuff = new StringBuilder(512);
            while (!heartBeatStatus.compareAndSet(0, 1)) {
                ThreadUtils.sleep(100);
            }
            // print metrics information
            clientStatsInfo.selfPrintStatsInfo(false, true, strBuff);
            // check whether public topics
            if (publishTopics.isEmpty()) {
                return;
            }
            try {
                ClientMaster.HeartResponseM2P response =
                        masterService.producerHeartbeatP2M(createHeartbeatRequest(),
                                AddressUtils.getLocalAddress(), tubeClientConfig.isTlsEnable());
                if (response == null || !response.getSuccess()) {
                    heartbeatRetryTimes++;
                    if (response == null) {
                        clientStatsInfo.bookHB2MasterException();
                        logger.error("[Heartbeat Failed] receive null HeartResponseM2P response!");
                    } else {
                        logger.error(strBuff.append("[Heartbeat Failed] ")
                                .append(response.getErrMsg()).toString());
                        strBuff.delete(0, strBuff.length());
                        if (response.getErrCode() == TErrCodeConstants.HB_NO_NODE) {
                            clientStatsInfo.bookHB2MasterTimeout();
                            try {
                                register2Master();
                            } catch (Throwable ee) {
                                logger.error(strBuff
                                        .append("[Heartbeat Failed] re-register failure, error is ")
                                        .append(ee.getMessage()).toString());
                                strBuff.delete(0, strBuff.length());
                            }
                        } else {
                            clientStatsInfo.bookHB2MasterException();
                            if (response.getErrCode() == TErrCodeConstants.CERTIFICATE_FAILURE) {
                                adjustHeartBeatPeriod("certificate failure", strBuff);
                            }
                        }
                    }
                    return;
                }
                processHeartBeatSyncInfo(response, strBuff);
                heartbeatRetryTimes = 0;
                long currentTime = System.currentTimeMillis();
                if ((currentTime - lastHeartbeatTime) > (tubeClientConfig.getHeartbeatPeriodMs() * 4)) {
                    logger.warn(strBuff.append(producerId)
                            .append(" heartbeat interval is too long, please check! Total time : ")
                            .append(currentTime - lastHeartbeatTime).toString());
                    strBuff.delete(0, strBuff.length());
                }
                lastHeartbeatTime = currentTime;
            } catch (Throwable e) {
                strBuff.delete(0, strBuff.length());
                if (!(e.getCause() != null
                        && e.getCause() instanceof ClientClosedException)) {
                    logger.error("Heartbeat failed,retry later.Reason:{}",
                            strBuff.append(e.getClass().getSimpleName())
                                    .append("#").append(e.getMessage()).toString());
                    strBuff.delete(0, strBuff.length());
                }
                adjustHeartBeatPeriod("heartbeat exception", strBuff);
            } finally {
                heartBeatStatus.compareAndSet(1, 0);
            }
        }
Get partitions of the given topic.

@param topic topic name
@return partition map
inlong-tubemq/tubemq-client/src/main/java/org/apache/inlong/tubemq/client/producer/ProducerManager.java