public class SimpleHealthCheck extends Object implements HealthCheck
HealthCheck
implementation, which may be used
if the health is okay, if a certain command ran sucessfully, e.g. instantiating an object, or similar.Constructor and Description |
---|
SimpleHealthCheck(java.util.function.Supplier<String> descriptionSupplier) |
Modifier and Type | Method and Description |
---|---|
String |
getDescription()
The description of the
HealthCheck , e.g. |
void |
markError(Exception e) |
void |
markSucess() |
Response |
perform(Context context)
Implements the check itself, e.g.
|
public SimpleHealthCheck(java.util.function.Supplier<String> descriptionSupplier)
public String getDescription()
HealthCheck
HealthCheck
, e.g. "Connecting to OpenNMS ReST API".
This is used when visualizing the progress or result of the checks.getDescription
in interface HealthCheck
public Response perform(Context context) throws Exception
HealthCheck
HealthCheckService
, it is advised that all timeout restrictions
etc are handled by the service instead of the HealthCheck
implementation.
Implementations might throw an Exception, which should be handled by the HealthCheckService
as well.
The response indicates if the check was successful, or encountered other problems. If null is returned,
the HealthCheckService
should consider this as Status.Unknown
.perform
in interface HealthCheck
Exception
- In case of an errorHealthCheckService
public void markSucess()
public void markError(Exception e)
Copyright © 2020. All rights reserved.