public void check() {
		Schedulers.single().schedulePeriodically(() -> {
			String applicationName = environment.getProperty("spring.application.name");
			String ip = sidecarProperties.getIp();
			Integer port = sidecarProperties.getPort();

			Status status = healthIndicator.health().getStatus();

			SidecarInstanceInfo sidecarInstanceInfo = instanceCache(applicationName, ip,
					port, status);
			if (status.equals(Status.UP)) {
				if (needRegister(applicationName, sidecarInstanceInfo)) {
					this.sidecarDiscoveryClient.registerInstance(applicationName, ip,
							port);
					log.info(
							"Polyglot service changed and Health check success. register the new instance. applicationName = {}, ip = {}, port = {}, status = {}",
							applicationName, ip, port, status);
				}
			}
			else {
				log.warn(
						"Health check failed. unregister this instance. applicationName = {}, ip = {}, port = {}, status = {}",
						applicationName, ip, port, status);
				this.sidecarDiscoveryClient.deregisterInstance(applicationName, ip, port);

				sidecarInstanceCacheMap.put(applicationName,
						buildCache(ip, port, status));
			}

			try {
				customHealthCheckHandlerObjectProvider
						.ifAvailable(customHealthCheckHandler -> customHealthCheckHandler
								.handler(applicationName, sidecarInstanceInfo));
			}
			catch (Exception e) {
				// ignore
			}
		}, 0, sidecarProperties.getHealthCheckInterval(), TimeUnit.MILLISECONDS);
	}
@author www.itmuch.com
@author yuhuangbin
spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sidecar/src/main/java/com/alibaba/cloud/sidecar/SidecarHealthChecker.java