public interface LoadBalancingHandler
A LoadBalancingHandler is the runtime component of a LoadBalancingStrategy that provides the logic for
load balancing requests to TargetHosts configured for a Site.
LoadBalancingHandler implementations must be thread-safe; that is, multiple threads may be running through a single instance of the implementation at any one time.
A LoadBalancingHandler instance is scoped to the Site to which the LoadBalancingStrategy is assigned, and a
single instance is created for each assignment of a LoadBalancingStrategy to a Site,
by the EntityScopedHandlerPlugin.getHandler() method. This constraint also implies
that a single LoadBalancingHandler instance will only ever see TargetHosts for a single Site.
Any server-side state for a LoadBalancingStrategy should be stored as members of the LoadBalancingHandler
implementation because a LoadBalancingHandler instance may persist across changes in the associated
LoadBalancingStrategy configuration.
This behavior is controlled by the EntityScopedHandlerPlugin.getHandler(Object)
method. This functionality facilitates the storage of server-side state that persists across changes in the
configuration such as the addition of new TargetHosts to a Site or changes to the
LoadBalancingStrategy configuration.
A LoadBalancingHandler is guaranteed to process an exchange after both Rules and SiteAuthenticators have
processed the exchange.
| Modifier and Type | Method and Description |
|---|---|
TargetHost |
calculateTargetHost(Exchange exchange,
List<TargetHost> availableHosts,
List<TargetHost> configuredHosts)
Calculate the target host, given the list of available hosts and the current exchange.
|
void |
handleResponse(Exchange exchange,
TargetHost targetHost)
Updates any internal data based on the response and optionally updates the response.
|
TargetHost calculateTargetHost(Exchange exchange, List<TargetHost> availableHosts, List<TargetHost> configuredHosts)
TargetHost is detected as unavailable after it is
selected.
To store data in between invocations, use the
Exchange.setProperty(ExchangeProperty, Object) method.exchange - The exchange.availableHosts - The list of available hosts for a Site. This list cannot be modified by implementations.configuredHosts - The list of configured hosts for a Site. This can be used to determine which hosts for the
Site are available and perform any necessary cleanup for this case. This list cannot be
modified by implementations.void handleResponse(Exchange exchange, TargetHost targetHost)
exchange - The exchange containing the response.targetHost - The target host used for the request.Copyright 2023 Ping Identity Corp. All rights reserved.