Skip to content

Commit

Permalink
HttpLoadBalancerFactory should override newLoadBalancer with 3 ar…
Browse files Browse the repository at this point in the history
…gs (#1935)

Motivation:

#1831 added a new
`LoadBalancerFactory#newLoadBalancer(String, Publisher, ConnectionFactory)`
overload, but didn't override it in `HttpLoadBalancerFactory`.

Modifications:

- Add `HttpLoadBalancerFactory.newLoadBalancer(...)` overload with 3
arguments;

Result:

`HttpLoadBalancerFactory` follows `LoadBalancerFactory` contract with
http-specific types.
  • Loading branch information
idelpivnitskiy committed Nov 15, 2021
1 parent ad81b3f commit c08a411
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
import io.servicetalk.client.api.ServiceDiscovererEvent;
import io.servicetalk.concurrent.api.Publisher;

import java.util.Collection;

import static java.util.function.Function.identity;

/**
* A {@link LoadBalancerFactory} for HTTP clients.
*
Expand All @@ -29,11 +33,20 @@
public interface HttpLoadBalancerFactory<ResolvedAddress>
extends LoadBalancerFactory<ResolvedAddress, FilterableStreamingHttpLoadBalancedConnection> {

@Deprecated
@Override
<T extends FilterableStreamingHttpLoadBalancedConnection> LoadBalancer<T> newLoadBalancer(
Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher,
ConnectionFactory<ResolvedAddress, T> cf);

@Override
default <T extends FilterableStreamingHttpLoadBalancedConnection> LoadBalancer<T> newLoadBalancer(
String targetResource,
Publisher<? extends Collection<? extends ServiceDiscovererEvent<ResolvedAddress>>> eventPublisher,
ConnectionFactory<ResolvedAddress, T> cf) {
return newLoadBalancer(eventPublisher.flatMapConcatIterable(identity()), cf);
}

/**
* Converts the passed {@link FilterableStreamingHttpConnection} to a
* {@link FilterableStreamingHttpLoadBalancedConnection}.
Expand Down

0 comments on commit c08a411

Please sign in to comment.