Package io.servicetalk.http.netty
Class DefaultHttpLoadBalancerFactory<ResolvedAddress>
- java.lang.Object
-
- io.servicetalk.http.netty.DefaultHttpLoadBalancerFactory<ResolvedAddress>
-
- Type Parameters:
ResolvedAddress- The type of address after resolution.
- All Implemented Interfaces:
LoadBalancerFactory<ResolvedAddress,FilterableStreamingHttpLoadBalancedConnection>,HttpExecutionStrategyInfluencer,HttpLoadBalancerFactory<ResolvedAddress>
public final class DefaultHttpLoadBalancerFactory<ResolvedAddress> extends java.lang.Object implements HttpLoadBalancerFactory<ResolvedAddress>, HttpExecutionStrategyInfluencer
Default implementation ofHttpLoadBalancerFactory.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultHttpLoadBalancerFactory.Builder<ResolvedAddress>A builder for creating instances ofDefaultHttpLoadBalancerFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpExecutionStrategyinfluenceStrategy(HttpExecutionStrategy strategy)Optionally modify the passedHttpExecutionStrategyto a newHttpExecutionStrategythat suits thisHttpExecutionStrategyInfluencer.<T extends FilterableStreamingHttpLoadBalancedConnection>
LoadBalancer<T>newLoadBalancer(Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher, ConnectionFactory<ResolvedAddress,T> cf)Create a newLoadBalancer.FilterableStreamingHttpLoadBalancedConnectiontoLoadBalancedConnection(FilterableStreamingHttpConnection connection)Converts the passedFilterableStreamingHttpConnectionto aFilterableStreamingHttpLoadBalancedConnection.
-
-
-
Method Detail
-
newLoadBalancer
public <T extends FilterableStreamingHttpLoadBalancedConnection> LoadBalancer<T> newLoadBalancer(Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher, ConnectionFactory<ResolvedAddress,T> cf)
Description copied from interface:LoadBalancerFactoryCreate a newLoadBalancer.- Specified by:
newLoadBalancerin interfaceHttpLoadBalancerFactory<ResolvedAddress>- Specified by:
newLoadBalancerin interfaceLoadBalancerFactory<ResolvedAddress,FilterableStreamingHttpLoadBalancedConnection>- Type Parameters:
T- Type of connections created by the passedConnectionFactory.- Parameters:
eventPublisher- A stream ofServiceDiscovererEvents which theLoadBalancercan use to connect to physical hosts. Typically generated from aServiceDiscoverer.cf-ConnectionFactorythat the returnedLoadBalancerwill use to generate new connections. ReturnedLoadBalancerwill own the responsibility for thisConnectionFactoryand hence will callAsyncCloseable.closeAsync()whenAsyncCloseable.closeAsync()is called.- Returns:
- a new
LoadBalancer.
-
toLoadBalancedConnection
public FilterableStreamingHttpLoadBalancedConnection toLoadBalancedConnection(FilterableStreamingHttpConnection connection)
Description copied from interface:HttpLoadBalancerFactoryConverts the passedFilterableStreamingHttpConnectionto aFilterableStreamingHttpLoadBalancedConnection.- Specified by:
toLoadBalancedConnectionin interfaceHttpLoadBalancerFactory<ResolvedAddress>- Parameters:
connection-FilterableStreamingHttpConnectionto convert.- Returns:
FilterableStreamingHttpLoadBalancedConnectionfor the passedFilterableStreamingHttpConnection.
-
influenceStrategy
public HttpExecutionStrategy influenceStrategy(HttpExecutionStrategy strategy)
Description copied from interface:HttpExecutionStrategyInfluencerOptionally modify the passedHttpExecutionStrategyto a newHttpExecutionStrategythat suits thisHttpExecutionStrategyInfluencer.- Specified by:
influenceStrategyin interfaceHttpExecutionStrategyInfluencer- Parameters:
strategy-HttpExecutionStrategyto influence.- Returns:
HttpExecutionStrategythat suits thisHttpExecutionStrategyInfluencer
-
-