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 void
bootstrapHealthCheck()
Starts the healthcheck service.void
bootstrapNotifierList()
Starts all notifiers that have been enable with the healthcheck service.UnprocessedChangeEvents
changed(PropertyChangeEvent[] events)
Notification that @Configured objects that were injected have changedvoid
collect(fish.payara.monitoring.collect.MonitoringDataCollector rootCollector)
void
event(EventListener.Event event)
Process a Glassfish/Payara eventBaseHealthCheck
getCheck(String serviceName)
HealthCheckServiceConfiguration
getConfiguration()
Gets the current configuration of the healthcheck serviceSet<String>
getEnabledNotifiers()
Gets a list of all notifiers enabled the healthcheck service.Integer
getHistoricalTraceStoreSize()
Gets the number of healthchecks to be stored.boolean
isEnabled()
boolean
isHistoricalTraceEnabled()
Returns true if historic healthchecks are storedvoid
reboot()
Restartes the healthcheck service and gets the configuration for itvoid
registerCheck(String name, BaseHealthCheck check)
void
setConfiguration(HealthCheckServiceConfiguration configuration)
void
setEnabled(Boolean enabled)
Sets whether the healthcheck service is enabled.void
setHistoricalTraceEnabled(boolean historicalTraceEnabled)
Sets whether historic healthchecks are storedvoid
setHistoricalTraceStoreSize(Integer historicalTraceStoreSize)
Sets the amount of historic healthchecks to storevoid
setHistoricalTraceStoreTimeout(long historicalTraceStoreTimeout)
Sets the length in seconds to keep historic healthchecks, ones older than this will be discarded.void
shutdownHealthCheck()
Gracefully shuts down the healthcheck service
-
-
-
Method Detail
-
collect
public void collect(fish.payara.monitoring.collect.MonitoringDataCollector rootCollector)
- Specified by:
collect
in interfacefish.payara.monitoring.collect.MonitoringDataSource
-
event
public void event(EventListener.Event event)
Description copied from interface:EventListener
Process a Glassfish/Payara event- Specified by:
event
in 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:ConfigListener
Notification that @Configured objects that were injected have changed- Specified by:
changed
in interfaceConfigListener
- Parameters:
events
- list of changes- Returns:
- the list of unprocessed events (requiring a restart) or null if all reconfiguration was processed successfully
-
-