From 4459dc73b9fdc6b82ce8903dbdb06dc36d41d0b3 Mon Sep 17 00:00:00 2001 From: nkorange Date: Fri, 30 Aug 2019 10:15:38 +0800 Subject: [PATCH] Fix #1764 --- .../naming/healthcheck/HealthCheckProcessorDelegate.java | 2 +- .../nacos/naming/healthcheck/HttpHealthCheckProcessor.java | 4 +++- .../nacos/naming/healthcheck/MysqlHealthCheckProcessor.java | 4 +++- .../nacos/naming/healthcheck/NoneHealthCheckProcessor.java | 4 +++- .../nacos/naming/healthcheck/TcpSuperSenseProcessor.java | 4 +++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/HealthCheckProcessorDelegate.java b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/HealthCheckProcessorDelegate.java index 1de6acb09..e85af4a69 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/HealthCheckProcessorDelegate.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/HealthCheckProcessorDelegate.java @@ -50,7 +50,7 @@ public class HealthCheckProcessorDelegate implements HealthCheckProcessor { String type = task.getCluster().getHealthChecker().getType(); HealthCheckProcessor processor = healthCheckProcessorMap.get(type); if(processor == null){ - processor = healthCheckProcessorMap.get("none"); + processor = healthCheckProcessorMap.get(NoneHealthCheckProcessor.TYPE); } processor.process(task); diff --git a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/HttpHealthCheckProcessor.java b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/HttpHealthCheckProcessor.java index 064de1e12..b03f7e359 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/HttpHealthCheckProcessor.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/HttpHealthCheckProcessor.java @@ -47,6 +47,8 @@ import static com.alibaba.nacos.naming.misc.Loggers.SRV_LOG; @Component public class HttpHealthCheckProcessor implements HealthCheckProcessor { + public static final String TYPE = "HTTP"; + @Autowired private SwitchDomain switchDomain; @@ -79,7 +81,7 @@ public class HttpHealthCheckProcessor implements HealthCheckProcessor { @Override public String getType() { - return "HTTP"; + return TYPE; } @Override diff --git a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/MysqlHealthCheckProcessor.java b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/MysqlHealthCheckProcessor.java index 756d7fcba..1ce59f46c 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/MysqlHealthCheckProcessor.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/MysqlHealthCheckProcessor.java @@ -45,6 +45,8 @@ import static com.alibaba.nacos.naming.misc.Loggers.SRV_LOG; @Component public class MysqlHealthCheckProcessor implements HealthCheckProcessor { + public static final String TYPE = "MYSQL"; + @Autowired private HealthCheckCommon healthCheckCommon; @@ -83,7 +85,7 @@ public class MysqlHealthCheckProcessor implements HealthCheckProcessor { @Override public String getType() { - return "MYSQL"; + return TYPE; } @Override diff --git a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/NoneHealthCheckProcessor.java b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/NoneHealthCheckProcessor.java index c7bf4a84d..221e6770d 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/NoneHealthCheckProcessor.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/NoneHealthCheckProcessor.java @@ -26,12 +26,14 @@ import org.springframework.stereotype.Component; @Component public class NoneHealthCheckProcessor implements HealthCheckProcessor { + public static final String TYPE = "NONE"; + @Override public void process(HealthCheckTask task) { } @Override public String getType() { - return "NONE"; + return TYPE; } } diff --git a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/TcpSuperSenseProcessor.java b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/TcpSuperSenseProcessor.java index 4d6cb676c..117a231e2 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/TcpSuperSenseProcessor.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/TcpSuperSenseProcessor.java @@ -43,6 +43,8 @@ import static com.alibaba.nacos.naming.misc.Loggers.SRV_LOG; @Component public class TcpSuperSenseProcessor implements HealthCheckProcessor, Runnable { + public static final String TYPE = "TCP"; + @Autowired private HealthCheckCommon healthCheckCommon; @@ -420,6 +422,6 @@ public class TcpSuperSenseProcessor implements HealthCheckProcessor, Runnable { @Override public String getType() { - return "TCP"; + return TYPE; } }