Skip to content

Commit

Permalink
Correct typo in MP health example (#8131)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjquinno authored Dec 11, 2023
1 parent 6e5d172 commit 990e5d5
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions docs/mp/guides/health.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 990e5d5

Please sign in to comment.