Module org.elasticsearch.server
Class HealthTracker<T>
java.lang.Object
org.elasticsearch.health.node.tracker.HealthTracker<T>
- Type Parameters:
T
- the type of the health check result they track
- Direct Known Subclasses:
DiskHealthTracker
,RepositoriesHealthTracker
Base class for health trackers that will be executed by the
LocalHealthMonitor
. It keeps track of the last
reported health and can retrieve the current health status when requested.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the last reported health to the request builder.protected abstract void
addToRequestBuilder
(UpdateHealthInfoCacheAction.Request.Builder builder, T healthInfo) Add the health info to the request builder.boolean
Determine the current health info for this tracker and check if it has changed from the last reported value.protected abstract T
Determine the health info for this health check.void
reset()
Reset the value oflastReportedValue
tonull
.
-
Constructor Details
-
HealthTracker
public HealthTracker()
-
-
Method Details
-
determineCurrentHealth
Determine the health info for this health check.- Returns:
- the health info.
-
addToRequestBuilder
protected abstract void addToRequestBuilder(UpdateHealthInfoCacheAction.Request.Builder builder, T healthInfo) Add the health info to the request builder.- Parameters:
builder
- the builder to add the health info to.healthInfo
- the health info to add.
-
addToRequestBuilder
Add the last reported health to the request builder. -
checkHealthChanged
public boolean checkHealthChanged()Determine the current health info for this tracker and check if it has changed from the last reported value. When the health has changed, we'll store the new health as the last reported value.- Returns:
- whether the health has changed.
-
reset
public void reset()Reset the value oflastReportedValue
tonull
. Should be used when, for example, the master or health node has changed. -
getLastDeterminedHealth
-