public class HealthCheckRegistry extends Object
| Constructor and Description |
|---|
HealthCheckRegistry()
Creates a new
HealthCheckRegistry. |
HealthCheckRegistry(int asyncExecutorPoolSize)
Creates a new
HealthCheckRegistry. |
HealthCheckRegistry(ScheduledExecutorService asyncExecutorService)
Creates a new
HealthCheckRegistry. |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(HealthCheckRegistryListener listener)
Adds a
HealthCheckRegistryListener to a collection of listeners that will be notified on health check
registration. |
HealthCheck |
getHealthCheck(String name)
Returns the
HealthCheck instance with a given name |
SortedSet<String> |
getNames()
Returns a set of the names of all registered health checks.
|
void |
register(String name,
HealthCheck healthCheck)
Registers an application
HealthCheck. |
void |
removeListener(HealthCheckRegistryListener listener)
Removes a
HealthCheckRegistryListener from this registry's collection of listeners. |
HealthCheck.Result |
runHealthCheck(String name)
Runs the health check with the given name.
|
SortedMap<String,HealthCheck.Result> |
runHealthChecks()
Runs the registered health checks and returns a map of the results.
|
SortedMap<String,HealthCheck.Result> |
runHealthChecks(ExecutorService executor)
Runs the registered health checks in parallel and returns a map of the results.
|
SortedMap<String,HealthCheck.Result> |
runHealthChecks(ExecutorService executor,
HealthCheckFilter filter)
Runs the registered health checks matching the filter in parallel and returns a map of the results.
|
SortedMap<String,HealthCheck.Result> |
runHealthChecks(HealthCheckFilter filter)
Runs the registered health checks matching the filter and returns a map of the results.
|
void |
shutdown()
Shuts down the scheduled executor for async health checks
|
void |
unregister(String name)
Unregisters the application
HealthCheck with the given name. |
public HealthCheckRegistry()
HealthCheckRegistry.public HealthCheckRegistry(int asyncExecutorPoolSize)
HealthCheckRegistry.asyncExecutorPoolSize - core pool size for async health check executionspublic HealthCheckRegistry(ScheduledExecutorService asyncExecutorService)
HealthCheckRegistry.asyncExecutorService - executor service for async health check executionspublic void addListener(HealthCheckRegistryListener listener)
HealthCheckRegistryListener to a collection of listeners that will be notified on health check
registration. Listeners will be notified in the order in which they are added. The listener will be notified of all
existing health checks when it first registers.listener - listener to addpublic void removeListener(HealthCheckRegistryListener listener)
HealthCheckRegistryListener from this registry's collection of listeners.listener - listener to removepublic void register(String name, HealthCheck healthCheck)
HealthCheck.name - the name of the health checkhealthCheck - the HealthCheck instancepublic void unregister(String name)
HealthCheck with the given name.name - the name of the HealthCheck instancepublic SortedSet<String> getNames()
public HealthCheck getHealthCheck(String name)
HealthCheck instance with a given namename - the name of the HealthCheck instancepublic HealthCheck.Result runHealthCheck(String name) throws NoSuchElementException
name - the health check's nameNoSuchElementException - if there is no health check with the given namepublic SortedMap<String,HealthCheck.Result> runHealthChecks()
public SortedMap<String,HealthCheck.Result> runHealthChecks(HealthCheckFilter filter)
filter - health check filterpublic SortedMap<String,HealthCheck.Result> runHealthChecks(ExecutorService executor)
executor - object to launch and track health checks progresspublic SortedMap<String,HealthCheck.Result> runHealthChecks(ExecutorService executor, HealthCheckFilter filter)
executor - object to launch and track health checks progressfilter - health check filterpublic void shutdown()
Copyright © 2021. All rights reserved.