Class DefaultHealthIndicatorRegistry
- java.lang.Object
- org.springframework.boot.actuate.health.DefaultHealthIndicatorRegistry
- All Implemented Interfaces:
HealthIndicatorRegistry
public class DefaultHealthIndicatorRegistry extends Object implements HealthIndicatorRegistry
Default implementation ofHealthIndicatorRegistry
.- Since:
- 2.1.0
Constructor Summary
Constructors Constructor Description DefaultHealthIndicatorRegistry()
Create a newDefaultHealthIndicatorRegistry
.DefaultHealthIndicatorRegistry(Map<String,HealthIndicator> healthIndicators)
Create a newDefaultHealthIndicatorRegistry
from the specified indicators.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HealthIndicator
get(String name)
Returns theHealthIndicator
registered with the givenname
.Map<String,HealthIndicator>
getAll()
Returns a snapshot of the registered health indicators and their names.void
register(String name, HealthIndicator healthIndicator)
Registers the givenHealthIndicator
, associating it with the givenname
.HealthIndicator
unregister(String name)
Unregisters theHealthIndicator
previously registered with the givenname
.
Constructor Detail
DefaultHealthIndicatorRegistry
public DefaultHealthIndicatorRegistry()
Create a newDefaultHealthIndicatorRegistry
.
DefaultHealthIndicatorRegistry
public DefaultHealthIndicatorRegistry(Map<String,HealthIndicator> healthIndicators)
Create a newDefaultHealthIndicatorRegistry
from the specified indicators.- Parameters:
healthIndicators
- a map ofHealthIndicator
s with the key being used as an indicator name.
Method Detail
register
public void register(String name, HealthIndicator healthIndicator)
Description copied from interface:HealthIndicatorRegistry
Registers the givenHealthIndicator
, associating it with the givenname
.- Specified by:
register
in interfaceHealthIndicatorRegistry
- Parameters:
name
- the name of the indicatorhealthIndicator
- the indicator
unregister
public HealthIndicator unregister(String name)
Description copied from interface:HealthIndicatorRegistry
Unregisters theHealthIndicator
previously registered with the givenname
.- Specified by:
unregister
in interfaceHealthIndicatorRegistry
- Parameters:
name
- the name of the indicator- Returns:
- the unregistered indicator, or
null
if no indicator was found in the registry for the givenname
.
get
public HealthIndicator get(String name)
Description copied from interface:HealthIndicatorRegistry
Returns theHealthIndicator
registered with the givenname
.- Specified by:
get
in interfaceHealthIndicatorRegistry
- Parameters:
name
- the name of the indicator- Returns:
- the health indicator, or
null
if no indicator was registered with the givenname
.
getAll
public Map<String,HealthIndicator> getAll()
Description copied from interface:HealthIndicatorRegistry
Returns a snapshot of the registered health indicators and their names. The contents of the map do not reflect subsequent changes to the registry.- Specified by:
getAll
in interfaceHealthIndicatorRegistry
- Returns:
- the snapshot of registered health indicators