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 creatingLoadBalancer
instances.
-
-
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 ofServiceDiscovererEvent
s which theLoadBalancer
can use to connect to physical hosts. Typically generated from aServiceDiscoverer
.connectionFactory
-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
.
-
-