public void heartbeat(InstanceHeartbeatRequest heartbeatRequest) {
		heartbeatExecutor.scheduleWithFixedDelay(() -> {
			try {
				// If the health check passes, the heartbeat will be reported.
				// If it does not pass, the heartbeat will not be reported.
				Map<String, String> headers = new HashMap<>(1);
				headers.put(HttpHeaders.USER_AGENT, "polaris");
				if (!OkHttpUtil.checkUrl(heartbeatRequest.getHost(), heartbeatRequest.getPort(),
						polarisDiscoveryProperties.getHealthCheckUrl(), headers)) {
					LOGGER.error("backend service health check failed. health check endpoint = {}",
							polarisDiscoveryProperties.getHealthCheckUrl());
					return;
				}

				polarisSDKContextManager.getProviderAPI().heartbeat(heartbeatRequest);
				LOGGER.trace("Polaris heartbeat is sent");
			}
			catch (PolarisException e) {
				LOGGER.error("polaris heartbeat error with code [{}]", e.getCode(), e);
			}
			catch (Exception e) {
				LOGGER.error("polaris heartbeat runtime error", e);
			}
		}, polarisDiscoveryProperties.getHeartbeatInterval(), polarisDiscoveryProperties.getHeartbeatInterval(), SECONDS);
	}
@Test
	void testHeartbeat() {
		this.contextRunner2.run(context -> {
			PolarisServiceRegistry registry = context.getBean(PolarisServiceRegistry.class);
			PolarisRegistration registration = Mockito.mock(PolarisRegistration.class);
			when(registration.getHost()).thenReturn("127.0.0.1");
			when(registration.getPort()).thenReturn(8080);
			when(registration.getServiceId()).thenReturn(SERVICE_PROVIDER);

			assertThatCode(() -> registry.register(registration)).doesNotThrowAnyException();

			Thread.sleep(6000);

			assertThatCode(() -> registry.deregister(registration)).doesNotThrowAnyException();
		});
	}