ResolvedAddress
- The type of address after resolution.C
- The type of connection.@FunctionalInterface
public interface LoadBalancerFactory<ResolvedAddress,C extends LoadBalancedConnection>
LoadBalancer
instances.Modifier and Type | Method and Description |
---|---|
LoadBalancer<? extends C> |
newLoadBalancer(Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher,
ConnectionFactory<ResolvedAddress,? extends C> connectionFactory)
Create a new
LoadBalancer . |
LoadBalancer<? extends C> newLoadBalancer(Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher, ConnectionFactory<ResolvedAddress,? extends C> connectionFactory)
LoadBalancer
.eventPublisher
- A stream of ServiceDiscovererEvent
s which the LoadBalancer
can use to
connect to physical hosts. Typically generated from a ServiceDiscoverer
.connectionFactory
- ConnectionFactory
that the returned LoadBalancer
will use to generate
new connections. Returned LoadBalancer
will own the responsibility for this ConnectionFactory
and hence will call AsyncCloseable.closeAsync()
when AsyncCloseable.closeAsync()
is called.LoadBalancer
.