Class AbstractHealthCheckedEndpointGroupBuilder
java.lang.Object
com.linecorp.armeria.client.endpoint.healthcheck.AbstractHealthCheckedEndpointGroupBuilder
- Direct Known Subclasses:
HealthCheckedEndpointGroupBuilder
A skeletal builder implementation for creating a new
HealthCheckedEndpointGroup
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns a newly createdHealthCheckedEndpointGroup
based on the properties set so far.clientFactory(ClientFactory clientFactory)
Sets theClientFactory
to use when making health check requests.clientOptions(ClientOptions clientOptions)
Sets theClientOptions
of theClient
that sends health check requests.maxEndpointCount(int maxEndpointCount)
Sets the maximum endpoint count of target selected candidates.maxEndpointRatio(double maxEndpointRatio)
Sets the maximum endpoint ratio of target selected candidates.protected abstract Function<? super HealthCheckerContext,? extends AsyncCloseable>
Returns theFunction
that starts to send health check requests to theEndpoint
specified in a givenHealthCheckerContext
when invoked.port(int port)
Sets the port where a health check request will be sent instead of the original port number specified byEndpointGroup
'sEndpoint
s.protocol(SessionProtocol protocol)
Sets theSessionProtocol
to be used when making health check requests.retryBackoff(Backoff retryBackoff)
Sets the backoff between health check requests.retryInterval(Duration retryInterval)
Sets the interval between health check requests.retryIntervalMillis(long retryIntervalMillis)
Sets the interval between health check requests in milliseconds.withClientOptions(Function<? super ClientOptionsBuilder,ClientOptionsBuilder> configurator)
-
Constructor Details
-
AbstractHealthCheckedEndpointGroupBuilder
Creates a newAbstractHealthCheckedEndpointGroupBuilder
.- Parameters:
delegate
- theEndpointGroup
which provides the candidateEndpoint
s
-
-
Method Details
-
clientFactory
Sets theClientFactory
to use when making health check requests. This should generally be the same as theClientFactory
used when creating aClient
stub using theEndpointGroup
. -
protocol
Sets theSessionProtocol
to be used when making health check requests. -
port
Sets the port where a health check request will be sent instead of the original port number specified byEndpointGroup
'sEndpoint
s. This property is useful when your server listens to health check requests on a different port. -
retryInterval
Sets the interval between health check requests. Must be positive. -
retryIntervalMillis
Sets the interval between health check requests in milliseconds. Must be positive. -
retryBackoff
Sets the backoff between health check requests. -
clientOptions
Sets theClientOptions
of theClient
that sends health check requests. This method can be useful if you already have an Armeria client and want to reuse its configuration, such as using the same decorators.WebClient myClient = ...; // Use the same settings and decorators with `myClient` when sending health check requests. builder.clientOptions(myClient.options());
-
withClientOptions
public AbstractHealthCheckedEndpointGroupBuilder withClientOptions(Function<? super ClientOptionsBuilder,ClientOptionsBuilder> configurator) -
maxEndpointRatio
Sets the maximum endpoint ratio of target selected candidates.- See Also:
PartialHealthCheckStrategyBuilder.maxEndpointRatio(double)
-
maxEndpointCount
Sets the maximum endpoint count of target selected candidates.- See Also:
PartialHealthCheckStrategyBuilder.maxEndpointCount(int)
-
build
Returns a newly createdHealthCheckedEndpointGroup
based on the properties set so far. -
newCheckerFactory
protected abstract Function<? super HealthCheckerContext,? extends AsyncCloseable> newCheckerFactory()Returns theFunction
that starts to send health check requests to theEndpoint
specified in a givenHealthCheckerContext
when invoked. TheFunction
must update the health of theEndpoint
with a value between [0, 1] viaHealthCheckerContext.updateHealth(double)
.HealthCheckedEndpointGroup
will callAsyncCloseable.closeAsync()
on theAsyncCloseable
returned by theFunction
when it needs to stop sending health check requests.
-