From 990e5d578f6b32e0e040eea3aa2f5b556d30f99e Mon Sep 17 00:00:00 2001 From: Tim Quinn Date: Mon, 11 Dec 2023 11:01:36 -0600 Subject: [PATCH] Correct typo in MP health example (#8131) --- docs/mp/guides/health.adoc | 49 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/docs/mp/guides/health.adoc b/docs/mp/guides/health.adoc index a806d52bc93..d48c400b4cd 100644 --- a/docs/mp/guides/health.adoc +++ b/docs/mp/guides/health.adoc @@ -300,41 +300,40 @@ package io.helidon.examples.quickstart.mp; import java.time.Duration; // <1> import java.util.concurrent.atomic.AtomicLong; -import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.Initialized; import jakarta.enterprise.event.Observes; import org.eclipse.microprofile.health.HealthCheck; import org.eclipse.microprofile.health.HealthCheckResponse; -import org.eclipse.microprofile.health.Started; +import org.eclipse.microprofile.health.Startup; -@Started // <2> +@Startup // <2> @ApplicationScoped public class GreetStartedCheck implements HealthCheck { - private final AtomicLong readyTime = new AtomicLong(0); - - - @Override - public HealthCheckResponse call() { - return HealthCheckResponse.named("StartedCheck") // <3> - .status(isStarted()) - .withData("time", readyTime.get()) - .build(); - } + private final AtomicLong readyTime = new AtomicLong(0); + + @Override + public HealthCheckResponse call() { + return HealthCheckResponse.named("StartedCheck") // <3> + .status(isStarted()) + .withData("time", readyTime.get()) + .build(); + } - public void onStartUp( - @Observes @Initialized(ApplicationScoped.class) Object init) { - readyTime.set(System.currentTimeMillis()); // <4> - } + public void onStartUp( + @Observes @Initialized(ApplicationScoped.class) Object init) { + readyTime.set(System.currentTimeMillis()); // <4> + } - /** - * Become ready after 5 seconds - * - * @return true if application ready - */ - private boolean isStarted() { - return Duration.ofMillis(System.currentTimeMillis() - readyTime.get()).getSeconds() >= 8; - } + /** + * Become ready after 5 seconds + * + * @return true if application ready + */ + private boolean isStarted() { + return Duration.ofMillis(System.currentTimeMillis() - readyTime.get()).getSeconds() >= 8; + } } ---- <1> Include additional imports.