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 class
DefaultHttpLoadBalancerFactory.Builder<ResolvedAddress>
A builder for creating instances ofDefaultHttpLoadBalancerFactory
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpExecutionStrategy
influenceStrategy(HttpExecutionStrategy strategy)
Optionally modify the passedHttpExecutionStrategy
to a newHttpExecutionStrategy
that suits thisHttpExecutionStrategyInfluencer
.<T extends FilterableStreamingHttpLoadBalancedConnection>
LoadBalancer<T>newLoadBalancer(Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher, ConnectionFactory<ResolvedAddress,T> cf)
Create a newLoadBalancer
.FilterableStreamingHttpLoadBalancedConnection
toLoadBalancedConnection(FilterableStreamingHttpConnection connection)
Converts the passedFilterableStreamingHttpConnection
to aFilterableStreamingHttpLoadBalancedConnection
.
-
-
-
Method Detail
-
newLoadBalancer
public <T extends FilterableStreamingHttpLoadBalancedConnection> LoadBalancer<T> newLoadBalancer(Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher, ConnectionFactory<ResolvedAddress,T> cf)
Description copied from interface:LoadBalancerFactory
Create a newLoadBalancer
.- Specified by:
newLoadBalancer
in interfaceHttpLoadBalancerFactory<ResolvedAddress>
- Specified by:
newLoadBalancer
in interfaceLoadBalancerFactory<ResolvedAddress,FilterableStreamingHttpLoadBalancedConnection>
- Type Parameters:
T
- Type of connections created by the passedConnectionFactory
.- Parameters:
eventPublisher
- A stream ofServiceDiscovererEvent
s which theLoadBalancer
can use to connect to physical hosts. Typically generated from aServiceDiscoverer
.cf
-ConnectionFactory
that the returnedLoadBalancer
will use to generate new connections. ReturnedLoadBalancer
will own the responsibility for thisConnectionFactory
and hence will callAsyncCloseable.closeAsync()
whenAsyncCloseable.closeAsync()
is called.- Returns:
- a new
LoadBalancer
.
-
toLoadBalancedConnection
public FilterableStreamingHttpLoadBalancedConnection toLoadBalancedConnection(FilterableStreamingHttpConnection connection)
Description copied from interface:HttpLoadBalancerFactory
Converts the passedFilterableStreamingHttpConnection
to aFilterableStreamingHttpLoadBalancedConnection
.- Specified by:
toLoadBalancedConnection
in interfaceHttpLoadBalancerFactory<ResolvedAddress>
- Parameters:
connection
-FilterableStreamingHttpConnection
to convert.- Returns:
FilterableStreamingHttpLoadBalancedConnection
for the passedFilterableStreamingHttpConnection
.
-
influenceStrategy
public HttpExecutionStrategy influenceStrategy(HttpExecutionStrategy strategy)
Description copied from interface:HttpExecutionStrategyInfluencer
Optionally modify the passedHttpExecutionStrategy
to a newHttpExecutionStrategy
that suits thisHttpExecutionStrategyInfluencer
.- Specified by:
influenceStrategy
in interfaceHttpExecutionStrategyInfluencer
- Parameters:
strategy
-HttpExecutionStrategy
to influence.- Returns:
HttpExecutionStrategy
that suits thisHttpExecutionStrategyInfluencer
-
-