public abstract class IsolatedHealthMonitor<T> extends Object implements Runnable, Monitor<T>
Monitor and Runnable
Maintains the latest state of the Monitor, and its latest updated timestampPingCheckMonitor,
RotationStatusMonitor,
CountMonitor| Constructor and Description |
|---|
IsolatedHealthMonitor(String name,
TimeEntity runInterval) |
IsolatedHealthMonitor(String name,
TimeEntity runInterval,
long stalenessAllowedInMillis) |
| Modifier and Type | Method and Description |
|---|---|
void |
disable()
disable the monitor, and dont use this monitor to track the aggregated health of the system
monitor is enabled by default
|
void |
enable()
enable the monitor, and consider it while aggregating the health of the system
monitor is enabled by default
|
T |
getHealthStatus() |
String |
getName() |
TimeEntity |
getRunInterval() |
boolean |
hasValidUpdatedTime(Date currentTime) |
boolean |
isDisabled() |
void |
run()
updates the healthStatus with the latest value from the monitor check
also updates the
lastStatusUpdateTime |
protected String name
public IsolatedHealthMonitor(String name, TimeEntity runInterval)
name - name of the monitorrunInterval - initial delay, time interval of how regularly the monitor is to be run, and timeunit
to specify how often the Monitor.monitor() check needs to be executedpublic IsolatedHealthMonitor(String name, TimeEntity runInterval, long stalenessAllowedInMillis)
name - name of the monitorrunInterval - initial delay, time interval of how regularly the monitor is to be run, and timeunit
to specify how often the Monitor.monitor() check needs to be executedstalenessAllowedInMillis - after how long (in milliseconds) should the monitor be regarded as stale (default: 60 seconds)public void run()
lastStatusUpdateTimepublic void disable()
public void enable()
public TimeEntity getRunInterval()
public T getHealthStatus()
public String getName()
public boolean isDisabled()
isDisabled in interface Monitor<T>public boolean hasValidUpdatedTime(Date currentTime)
Copyright © 2015–2022. All rights reserved.