healchow commented on code in PR #6184:
URL: https://github.com/apache/inlong/pull/6184#discussion_r997804725
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/heartbeat/HeartbeatManager.java:
##########
@@ -97,26 +99,36 @@ public void reportHeartbeat(HeartbeatMsg heartbeat) {
// if the heartbeat was not in the cache, insert or update the node by
the heartbeat info
HeartbeatMsg lastHeartbeat =
heartbeatCache.getIfPresent(componentHeartbeat);
- boolean exist = true;
- int updateNum = UPDATE_ZERO_ROW;
- if (lastHeartbeat == null) {
- exist = false;
- InlongClusterNodeEntity clusterNode = getClusterNode(clusterInfo,
heartbeat);
- if (clusterNode == null) {
- updateNum = insertClusterNode(clusterInfo, heartbeat,
clusterInfo.getCreator());
- log.info("insert node result: {}", updateNum);
- } else {
- updateNum = updateClusterNode(clusterNode);
- log.info("update node result: {}", updateNum);
+ String[] ports = heartbeat.getPort().split(InlongConstants.COMMA);
+ String protocolType = heartbeat.getProtocolType();
+ String[] protocolTypes = StringUtils.isNoneBlank(protocolType) &&
ports.length > 1
+ ? heartbeat.getProtocolType().split(InlongConstants.COMMA) :
null;
+ int handlerNum = 0;
+ for (int i = 0; i < ports.length; i++) {
+ HeartbeatMsg heartbeatMsg = OBJECT_MAPPER.readValue(
Review Comment:
Suggest using the `JsonUtils` instead of a new `ObjectMapper`.
--
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]