public abstract class HealthCheckWithGracePeriod extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Duration |
gracePeriod |
| Modifier | Constructor and Description |
|---|---|
protected |
HealthCheckWithGracePeriod(Duration gracePeriod,
TimeSource timeSource) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
check()
Executes the logic for determining whether the system is in a healthy state and returns the
result.
|
protected abstract boolean |
isHealthy()
Executes the specific logic for determining whether the system is in a healthy state.
|
protected void |
reset()
Resets the grace period marker.
|
protected final Duration gracePeriod
protected HealthCheckWithGracePeriod(Duration gracePeriod, TimeSource timeSource)
protected abstract boolean isHealthy()
check().true if the system is healthy, false otherwise.protected void reset()
public boolean check()
Actual health checks are performed by isHealthy(), this method additionally applies
the grace period (as set in the constructor) to failed checks.
true if the system is healthy, false otherwise.Copyright © 2022. All rights reserved.