Package io.servicetalk.client.api
Interface LoadBalancerFactory<ResolvedAddress,C extends LoadBalancedConnection>
-
- Type Parameters:
ResolvedAddress- The type of address after resolution.C- The type of connection.
- All Known Subinterfaces:
HttpLoadBalancerFactory<ResolvedAddress>
- All Known Implementing Classes:
DefaultHttpLoadBalancerFactory,RoundRobinLoadBalancer.RoundRobinLoadBalancerFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface LoadBalancerFactory<ResolvedAddress,C extends LoadBalancedConnection>A factory for creatingLoadBalancerinstances.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends C>
LoadBalancer<T>newLoadBalancer(Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher, ConnectionFactory<ResolvedAddress,T> connectionFactory)Create a newLoadBalancer.
-
-
-
Method Detail
-
newLoadBalancer
<T extends C> LoadBalancer<T> newLoadBalancer(Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher, ConnectionFactory<ResolvedAddress,T> connectionFactory)
Create a newLoadBalancer.- 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.connectionFactory-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.
-
-