Interface HealthCheckerContext
public interface HealthCheckerContext
Provides the properties and operations required for sending health check requests.
-
Method Summary
Modifier and TypeMethodDescriptionReturns theClientOptions
of theClient
that sends health check requests.endpoint()
Returns theEndpoint
to send health check requests to.executor()
Returns theScheduledExecutorService
which is used for scheduling the tasks related with sending health check requests.long
Returns the delay for the next health check request in milliseconds.protocol()
Returns theSessionProtocol
to be used when sending health check requests.void
updateHealth
(double health) Deprecated.default void
updateHealth
(double health, ClientRequestContext ctx, @Nullable ResponseHeaders headers, @Nullable Throwable cause) Updates the health of theEndpoint
being checked.
-
Method Details
-
endpoint
Endpoint endpoint()Returns theEndpoint
to send health check requests to. -
protocol
SessionProtocol protocol()Returns theSessionProtocol
to be used when sending health check requests. -
clientOptions
ClientOptions clientOptions()Returns theClientOptions
of theClient
that sends health check requests. -
executor
ScheduledExecutorService executor()Returns theScheduledExecutorService
which is used for scheduling the tasks related with sending health check requests. Note that theScheduledExecutorService
returned by this method cannot be shut down; callingExecutorService.shutdown()
orExecutorService.shutdownNow()
will trigger anUnsupportedOperationException
. -
nextDelayMillis
long nextDelayMillis()Returns the delay for the next health check request in milliseconds. -
updateHealth
Updates the health of theEndpoint
being checked. -
updateHealth
default void updateHealth(double health, ClientRequestContext ctx, @Nullable @Nullable ResponseHeaders headers, @Nullable @Nullable Throwable cause) Updates the health of theEndpoint
being checked.- Parameters:
health
-0.0
indicates theEndpoint
is not able to handle any requests. A positive value indicates theEndpoint
is able to handle requests. A value greater than1.0
will be set equal to1.0
.ctx
- theClientRequestContext
of the health check request.headers
- theResponseHeaders
of the health check request.null
if the request is failed with thecause
.cause
- the cause of the failed health check request.null
if the health checked request received theheaders
.
-
updateHealth(double, ClientRequestContext, ResponseHeaders, Throwable)
.