Package fish.payara.nucleus.healthcheck
Class HealthCheckService
- java.lang.Object
-
- fish.payara.nucleus.healthcheck.HealthCheckService
-
- All Implemented Interfaces:
fish.payara.monitoring.collect.MonitoringDataSource,EventListener,ConfigListener
@Service(name="healthcheck-core") @RunLevel(10) public class HealthCheckService extends Object implements EventListener, ConfigListener, fish.payara.monitoring.collect.MonitoringDataSource
- Since:
- 4.1.1.161
- Author:
- steve
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.glassfish.api.event.EventListener
EventListener.Event<T>
-
-
Constructor Summary
Constructors Constructor Description HealthCheckService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbootstrapHealthCheck()Starts the healthcheck service.voidbootstrapNotifierList()Starts all notifiers that have been enable with the healthcheck service.UnprocessedChangeEventschanged(PropertyChangeEvent[] events)Notification that @Configured objects that were injected have changedvoidcollect(fish.payara.monitoring.collect.MonitoringDataCollector rootCollector)voidevent(EventListener.Event event)Process a Glassfish/Payara eventBaseHealthCheckgetCheck(String serviceName)HealthCheckServiceConfigurationgetConfiguration()Gets the current configuration of the healthcheck serviceSet<String>getEnabledNotifiers()Gets a list of all notifiers enabled the healthcheck service.IntegergetHistoricalTraceStoreSize()Gets the number of healthchecks to be stored.booleanisEnabled()booleanisHistoricalTraceEnabled()Returns true if historic healthchecks are storedvoidreboot()Restartes the healthcheck service and gets the configuration for itvoidregisterCheck(String name, BaseHealthCheck check)voidsetConfiguration(HealthCheckServiceConfiguration configuration)voidsetEnabled(Boolean enabled)Sets whether the healthcheck service is enabled.voidsetHistoricalTraceEnabled(boolean historicalTraceEnabled)Sets whether historic healthchecks are storedvoidsetHistoricalTraceStoreSize(Integer historicalTraceStoreSize)Sets the amount of historic healthchecks to storevoidsetHistoricalTraceStoreTimeout(long historicalTraceStoreTimeout)Sets the length in seconds to keep historic healthchecks, ones older than this will be discarded.voidshutdownHealthCheck()Gracefully shuts down the healthcheck service
-
-
-
Method Detail
-
collect
public void collect(fish.payara.monitoring.collect.MonitoringDataCollector rootCollector)
- Specified by:
collectin interfacefish.payara.monitoring.collect.MonitoringDataSource
-
event
public void event(EventListener.Event event)
Description copied from interface:EventListenerProcess a Glassfish/Payara event- Specified by:
eventin interfaceEventListener
-
registerCheck
public void registerCheck(String name, BaseHealthCheck check)
-
bootstrapHealthCheck
public void bootstrapHealthCheck()
Starts the healthcheck service. This will also bootstrap any relevant notifiers.
-
bootstrapNotifierList
public void bootstrapNotifierList()
Starts all notifiers that have been enable with the healthcheck service.
-
isEnabled
public boolean isEnabled()
- Returns:
- Whether the healthcheck service is enabled
-
setEnabled
public void setEnabled(Boolean enabled)
Sets whether the healthcheck service is enabled.- Parameters:
enabled- If this is true, then the healcheck service will be started. If it is already enabled then healthcheck will be restarted.
-
reboot
public void reboot()
Restartes the healthcheck service and gets the configuration for it
-
shutdownHealthCheck
public void shutdownHealthCheck()
Gracefully shuts down the healthcheck service
-
getCheck
public BaseHealthCheck getCheck(String serviceName)
-
getConfiguration
public HealthCheckServiceConfiguration getConfiguration()
Gets the current configuration of the healthcheck service- Returns:
-
setConfiguration
public void setConfiguration(HealthCheckServiceConfiguration configuration)
-
isHistoricalTraceEnabled
public boolean isHistoricalTraceEnabled()
Returns true if historic healthchecks are stored- Returns:
-
setHistoricalTraceEnabled
public void setHistoricalTraceEnabled(boolean historicalTraceEnabled)
Sets whether historic healthchecks are stored- Parameters:
historicalTraceEnabled-
-
getHistoricalTraceStoreSize
public Integer getHistoricalTraceStoreSize()
Gets the number of healthchecks to be stored. This may be greater than 0 even ifisHistoricalTraceEnabled()returns false as this can be set independently- Returns:
-
setHistoricalTraceStoreSize
public void setHistoricalTraceStoreSize(Integer historicalTraceStoreSize)
Sets the amount of historic healthchecks to store- Parameters:
historicalTraceStoreSize-
-
setHistoricalTraceStoreTimeout
public void setHistoricalTraceStoreTimeout(long historicalTraceStoreTimeout)
Sets the length in seconds to keep historic healthchecks, ones older than this will be discarded.- Parameters:
historicalTraceStoreTimeout- if this is > 500 then 500 will be used as the limit.- See Also:
NotificationService
-
getEnabledNotifiers
public Set<String> getEnabledNotifiers()
Gets a list of all notifiers enabled the healthcheck service.- Returns:
-
changed
public UnprocessedChangeEvents changed(PropertyChangeEvent[] events)
Description copied from interface:ConfigListenerNotification that @Configured objects that were injected have changed- Specified by:
changedin interfaceConfigListener- Parameters:
events- list of changes- Returns:
- the list of unprocessed events (requiring a restart) or null if all reconfiguration was processed successfully
-
-