|
|
@ -41,7 +41,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.cloud.client.serviceregistry.Registration;
|
|
|
|
import org.springframework.cloud.client.serviceregistry.Registration;
|
|
|
|
import org.springframework.cloud.client.serviceregistry.ServiceRegistry;
|
|
|
|
import org.springframework.cloud.client.serviceregistry.ServiceRegistry;
|
|
|
|
|
|
|
|
|
|
|
|
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
|
|
|
import static java.util.concurrent.TimeUnit.SECONDS;
|
|
|
|
import static org.springframework.util.ReflectionUtils.rethrowRuntimeException;
|
|
|
|
import static org.springframework.util.ReflectionUtils.rethrowRuntimeException;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -69,8 +69,8 @@ public class PolarisServiceRegistry implements ServiceRegistry<Registration> {
|
|
|
|
this.staticMetadataManager = staticMetadataManager;
|
|
|
|
this.staticMetadataManager = staticMetadataManager;
|
|
|
|
|
|
|
|
|
|
|
|
if (polarisDiscoveryProperties.isHeartbeatEnabled()) {
|
|
|
|
if (polarisDiscoveryProperties.isHeartbeatEnabled()) {
|
|
|
|
this.heartbeatExecutor = Executors.newSingleThreadScheduledExecutor(
|
|
|
|
this.heartbeatExecutor = Executors
|
|
|
|
new NamedThreadFactory("spring-cloud-heartbeat"));
|
|
|
|
.newSingleThreadScheduledExecutor(new NamedThreadFactory("polaris-heartbeat"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
this.heartbeatExecutor = null;
|
|
|
|
this.heartbeatExecutor = null;
|
|
|
@ -207,13 +207,14 @@ public class PolarisServiceRegistry implements ServiceRegistry<Registration> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
polarisDiscoveryHandler.getProviderAPI().heartbeat(heartbeatRequest);
|
|
|
|
polarisDiscoveryHandler.getProviderAPI().heartbeat(heartbeatRequest);
|
|
|
|
|
|
|
|
LOGGER.trace("Polaris heartbeat is sent");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (PolarisException e) {
|
|
|
|
catch (PolarisException e) {
|
|
|
|
LOGGER.error("polaris heartbeat[{}]", e.getCode(), e);
|
|
|
|
LOGGER.error("polaris heartbeat error with code [{}]", e.getCode(), e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e) {
|
|
|
|
catch (Exception e) {
|
|
|
|
LOGGER.error("polaris heartbeat runtime error", e);
|
|
|
|
LOGGER.error("polaris heartbeat runtime error", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, polarisDiscoveryProperties.getHeartbeatInterval(), polarisDiscoveryProperties.getHeartbeatInterval(), MILLISECONDS);
|
|
|
|
}, polarisDiscoveryProperties.getHeartbeatInterval(), polarisDiscoveryProperties.getHeartbeatInterval(), SECONDS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|