private void runHealthCheck() {
            if (state != State.SCHEDULED) {
                return;
            }
            try {
                healthChecker.get().handle((result, throwable) -> {
                    final boolean isHealthy;
                    final long intervalMillis;
                    if (throwable != null) {
                        logger.warn("Health checker throws an exception, schedule the next check after {}ms.",
                                    fallbackTtl.toMillis(), throwable);
                        isHealthy = false;
                        intervalMillis = fallbackTtl.toMillis();
                    } else if (result == null) {
                        logger.warn("Health checker returns an unexpected null result, " +
                                    "schedule the next check after {}ms.",
                                    fallbackTtl.toMillis());
                        isHealthy = false;
                        intervalMillis = fallbackTtl.toMillis();
                    } else {
                        isHealthy = result.isHealthy();
                        intervalMillis = result.ttlMillis();
                    }
                    settableHealthChecker.setHealthy(isHealthy);
                    scheduledFuture = eventExecutor.schedule(this::runHealthCheck, intervalMillis,
                                                             TimeUnit.MILLISECONDS);
                    return null;
                });
            } catch (Throwable throwable) {
                logger.warn("Health checker throws an exception, schedule the next check after {}ms.",
                            fallbackTtl.toMillis(), throwable);
                settableHealthChecker.setHealthy(false);
                scheduledFuture = eventExecutor.schedule(this::runHealthCheck, fallbackTtl.toMillis(),
                                                         TimeUnit.MILLISECONDS);
            }
        }
Health checker can be scheduled only once. Calling startHealthChecker won't work after stopHealthChecker.
This class itself is not thread-safe and guarded by {@link ScheduledHealthChecker} to avoid calling
{@link ScheduledHealthChecker#startHealthChecker()} and
{@link ScheduledHealthChecker#stopHealthChecker()} concurrently.
core/src/main/java/com/linecorp/armeria/server/healthcheck/ScheduledHealthChecker.java