|
|
@ -18,6 +18,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
package com.tencent.cloud.polaris.registry;
|
|
|
|
package com.tencent.cloud.polaris.registry;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
|
@ -45,6 +47,7 @@ import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.cloud.client.serviceregistry.ServiceRegistry;
|
|
|
|
import org.springframework.cloud.client.serviceregistry.ServiceRegistry;
|
|
|
|
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
|
|
|
|
|
|
|
|
import static java.util.concurrent.TimeUnit.SECONDS;
|
|
|
|
import static java.util.concurrent.TimeUnit.SECONDS;
|
|
|
|
import static org.springframework.util.ReflectionUtils.rethrowRuntimeException;
|
|
|
|
import static org.springframework.util.ReflectionUtils.rethrowRuntimeException;
|
|
|
@ -224,7 +227,9 @@ public class PolarisServiceRegistry implements ServiceRegistry<PolarisRegistrati
|
|
|
|
String healthCheckUrl = String.format("http://%s:%s%s", heartbeatRequest.getHost(),
|
|
|
|
String healthCheckUrl = String.format("http://%s:%s%s", heartbeatRequest.getHost(),
|
|
|
|
heartbeatRequest.getPort(), healthCheckEndpoint);
|
|
|
|
heartbeatRequest.getPort(), healthCheckEndpoint);
|
|
|
|
|
|
|
|
|
|
|
|
if (!OkHttpUtil.get(healthCheckUrl, null)) {
|
|
|
|
Map<String, String> headers = new HashMap<>(1);
|
|
|
|
|
|
|
|
headers.put(HttpHeaders.USER_AGENT, "polaris");
|
|
|
|
|
|
|
|
if (!OkHttpUtil.get(healthCheckUrl, headers)) {
|
|
|
|
LOGGER.error("backend service health check failed. health check endpoint = {}",
|
|
|
|
LOGGER.error("backend service health check failed. health check endpoint = {}",
|
|
|
|
healthCheckEndpoint);
|
|
|
|
healthCheckEndpoint);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|