Interface HealthIndicatorRegistry
- All Known Implementing Classes:
DefaultHealthIndicatorRegistry
public interface HealthIndicatorRegistry
A registry ofHealthIndicators
.Implementations must be thread-safe.
- Since:
- 2.1.0
Method Summary
All Methods Instance Methods Abstract 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
.
Method Detail
register
void register(String name, HealthIndicator healthIndicator)
Registers the givenHealthIndicator
, associating it with the givenname
.- Parameters:
name
- the name of the indicatorhealthIndicator
- the indicator- Throws:
IllegalStateException
- if an indicator with the givenname
is already registered.
unregister
HealthIndicator unregister(String name)
Unregisters theHealthIndicator
previously registered with the givenname
.- 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
HealthIndicator get(String name)
Returns theHealthIndicator
registered with the givenname
.- Parameters:
name
- the name of the indicator- Returns:
- the health indicator, or
null
if no indicator was registered with the givenname
.
getAll
Map<String,HealthIndicator> getAll()
Returns a snapshot of the registered health indicators and their names. The contents of the map do not reflect subsequent changes to the registry.- Returns:
- the snapshot of registered health indicators