From 525f3bf43f20e9b42065e1165325fa7fa49f50d3 Mon Sep 17 00:00:00 2001 From: chen10038 <32610642+chen10038@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:47:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9:=20Fix=2012301=E3=80=82=20(#?= =?UTF-8?q?12310)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/alibaba/nacos/naming/core/v2/pojo/Service.java | 6 ++++++ .../healthcheck/v2/processor/TcpHealthCheckProcessor.java | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/naming/src/main/java/com/alibaba/nacos/naming/core/v2/pojo/Service.java b/naming/src/main/java/com/alibaba/nacos/naming/core/v2/pojo/Service.java index 93971aff0..711edd80c 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/core/v2/pojo/Service.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/core/v2/pojo/Service.java @@ -16,6 +16,7 @@ package com.alibaba.nacos.naming.core.v2.pojo; +import com.alibaba.nacos.api.common.Constants; import com.alibaba.nacos.api.naming.utils.NamingUtils; import java.io.Serializable; @@ -95,6 +96,11 @@ public class Service implements Serializable { public String getGroupedServiceName() { return NamingUtils.getGroupedName(name, group); } + + public String getNameSpaceGroupedServiceName() { + //do not String.intern + return namespace + Constants.SERVICE_INFO_SPLITER + NamingUtils.getGroupedName(name, group); + } @Override public boolean equals(Object o) { diff --git a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/v2/processor/TcpHealthCheckProcessor.java b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/v2/processor/TcpHealthCheckProcessor.java index 36e39b083..c9994cb3e 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/v2/processor/TcpHealthCheckProcessor.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/v2/processor/TcpHealthCheckProcessor.java @@ -102,7 +102,7 @@ public class TcpHealthCheckProcessor implements HealthCheckProcessorV2, Runnable // TODO handle marked(white list) logic like v1.x. if (!instance.tryStartCheck()) { SRV_LOG.warn("[HEALTH-CHECK-V2] tcp check started before last one finished, service: {} : {} : {}:{}", - service.getGroupedServiceName(), instance.getCluster(), instance.getIp(), instance.getPort()); + service.getNameSpaceGroupedServiceName(), instance.getCluster(), instance.getIp(), instance.getPort()); healthCheckCommon .reEvaluateCheckRT(task.getCheckRtNormalized() * 2, task, switchDomain.getTcpHealthParams()); return; @@ -287,7 +287,7 @@ public class TcpHealthCheckProcessor implements HealthCheckProcessorV2, Runnable @Override public String toString() { - return service.getGroupedServiceName() + ":" + instance.getCluster() + ":" + instance.getIp() + ":" + return service.getNameSpaceGroupedServiceName() + ":" + instance.getCluster() + ":" + instance.getIp() + ":" + instance.getPort(); }