Top Description Inners Fields Constructors Methods
org.eclipse.microprofile.health

public Class HealthCheckResponse

extends Object
Class Inheritance
Imports
java.security.AccessController, .PrivilegedAction, java.util.Map, .Optional, .ServiceLoader, java.util.logging.Level, .Logger, org.eclipse.microprofile.health.spi.HealthCheckResponseProvider

The response to a health check invocation.

The HealthCheckResponse class is reserved for an extension by implementation providers. An application should use one of the static methods to create a Response instance using a HealthCheckResponseBuilder. When used on the consuming end, The class can also be instantiated directly.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private final Optional<Map<String, Object>>
private static final Logger
private final String
private static volatile HealthCheckResponseProvider
private final HealthCheckResponse.Status

Constructor Summary

AccessConstructor and Description
public
HealthCheckResponse(String
Health Check procedure's name
name
,
HealthCheckResponse.Status
Health Check procedure's status
status
,
Optional<Map<String, Object>>
additional data for Health Check procedure
data
)

Constructor allowing instantiation from 3rd party framework like MicroProfile Rest client

public
HealthCheckResponse()

Default constructor

Method Summary

Modifier and TypeMethod and Description
public static HealthCheckResponseBuilder

Returns:

a new, empty health check builder
builder
()

Creates an empty HealthCheckResponseBuilder

Note

The health check response name is required and needs to be set before the response is constructed.

public static HealthCheckResponse

Returns:

a new failed health check response with a name
down
(String
the check name
name
)

Creates a failed health check with a name.

private static <T> T
find(Class<T> service)

private static <T> T
find(Class<T> service, ClassLoader cl)

private static ClassLoader
public Optional<Map<String, Object>>
public String
private static HealthCheckResponseProvider
public HealthCheckResponse.Status
public static HealthCheckResponseBuilder

Returns:

a new health check builder with a name
named
(String
the check name
name
)

Creates a HealthCheckResponseBuilder with a name.

public static void
setResponseProvider(HealthCheckResponseProvider
the provider instance to use.
provider
)

Used by OSGi environment where the service loader pattern is not supported.

public static HealthCheckResponse

Returns:

a new sucessful health check response with a name
up
(String
the check name
name
)

Creates a successful health check with a name.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
private final Optional<Map<String, Object>> data
LOGGERback to summary
private static final Logger LOGGER
nameback to summary
private final String name
providerback to summary
private static volatile HealthCheckResponseProvider provider
statusback to summary
private final HealthCheckResponse.Status status

Constructor Detail

HealthCheckResponseback to summary
public HealthCheckResponse(String name, HealthCheckResponse.Status status, Optional<Map<String, Object>> data)

Constructor allowing instantiation from 3rd party framework like MicroProfile Rest client

Parameters
name:String

Health Check procedure's name

status:HealthCheckResponse.Status

Health Check procedure's status

data:Optional<Map<String, Object>>

additional data for Health Check procedure

HealthCheckResponseback to summary
public HealthCheckResponse()

Default constructor

Method Detail

builderback to summary
public static HealthCheckResponseBuilder builder()

Creates an empty HealthCheckResponseBuilder

Note

The health check response name is required and needs to be set before the response is constructed.

Returns:HealthCheckResponseBuilder

a new, empty health check builder

downback to summary
public static HealthCheckResponse down(String name)

Creates a failed health check with a name.

Parameters
name:String

the check name

Returns:HealthCheckResponse

a new failed health check response with a name

findback to summary
private static <T> T find(Class<T> service)
findback to summary
private static <T> T find(Class<T> service, ClassLoader cl)
getContextClassLoaderback to summary
private static ClassLoader getContextClassLoader()
getDataback to summary
public Optional<Map<String, Object>> getData()
getNameback to summary
public String getName()
getProviderback to summary
private static HealthCheckResponseProvider getProvider()
getStatusback to summary
public HealthCheckResponse.Status getStatus()
namedback to summary
public static HealthCheckResponseBuilder named(String name)

Creates a HealthCheckResponseBuilder with a name.

Parameters
name:String

the check name

Returns:HealthCheckResponseBuilder

a new health check builder with a name

setResponseProviderback to summary
public static void setResponseProvider(HealthCheckResponseProvider provider)

Used by OSGi environment where the service loader pattern is not supported.

Parameters
provider:HealthCheckResponseProvider

the provider instance to use.

upback to summary
public static HealthCheckResponse up(String name)

Creates a successful health check with a name.

Parameters
name:String

the check name

Returns:HealthCheckResponse

a new sucessful health check response with a name

org.eclipse.microprofile.health back to summary

public final Enum HealthCheckResponse.Status

extends Enum<HealthCheckResponse.Status>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final HealthCheckResponse.Status
public static final HealthCheckResponse.Status

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static HealthCheckResponse.Status
public static HealthCheckResponse.Status[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DOWNback to summary
public static final HealthCheckResponse.Status DOWN
UPback to summary
public static final HealthCheckResponse.Status UP

Constructor Detail

Statusback to summary
private Status()

Method Detail

valueOfback to summary
public static HealthCheckResponse.Status valueOf(String name)
valuesback to summary
public static HealthCheckResponse.Status[] values()