@Experimental public class HealthCheckImpl extends Object implements HealthCheck
HealthCheck interface.
This class is responsible for periodically checking the health of a Redis endpoint and updating the health status accordingly.
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(HealthStatusListener listener)
Add a listener to be notified when the health status changes.
|
RedisURI |
getEndpoint()
Get the endpoint being monitored.
|
long |
getMaxWaitFor()
Get the maximum wait duration (in milliseconds) to wait for health check HealthStatus reach stable state.
|
HealthStatus |
getStatus()
Get the current health status of the endpoint.
|
void |
removeListener(HealthStatusListener listener)
Remove a previously registered listener.
|
void |
start()
Start the health check.
|
void |
stop()
Stop the health check.
|
public RedisURI getEndpoint()
HealthCheckgetEndpoint in interface HealthCheckpublic HealthStatus getStatus()
HealthCheckgetStatus in interface HealthCheckpublic void start()
HealthCheckstart in interface HealthCheckpublic void stop()
HealthCheckstop in interface HealthCheckpublic long getMaxWaitFor()
HealthCheckTransition to stable state means either HEALTHY or UNHEALTHY. UNKNOWN is not considered stable. This is calculated based on the health check strategy's timeout, retry delay and retry count.
getMaxWaitFor in interface HealthCheckpublic void addListener(HealthStatusListener listener)
HealthCheckThe listener will be invoked whenever the health status transitions from one state to another (e.g., HEALTHY to UNHEALTHY, UNKNOWN to HEALTHY, etc.).
addListener in interface HealthChecklistener - the listener to add, must not be nullpublic void removeListener(HealthStatusListener listener)
HealthCheckremoveListener in interface HealthChecklistener - the listener to remove, must not be nullCopyright © 2025 lettuce.io. All rights reserved.