Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve LoadBalancerFactory#newLoadBalancer() generics #1085

Merged
merged 1 commit into from
Jun 15, 2020

Conversation

NiteshKant
Copy link
Collaborator

Motivation

LoadBalancerFactory#newLoadBalancer() does not allow for the passed ConnectionFactory to influence type of the LoadBalancedConnection managed by the returned LoadBalancer. This forces users of this API (Http client builder implementations) to do an explicit cast.

Modification

Improve generics of LoadBalancerFactory#newLoadBalancer() to infer the returned LoadBalancer generics from the passed ConnectionFactory

Result

No explicit casts while using LoadBalancerFactory#newLoadBalancer().

__Motivation__

`LoadBalancerFactory#newLoadBalancer()` does not allow for the passed `ConnectionFactory` to influence type of the `LoadBalancedConnection` managed by the returned `LoadBalancer`. This forces users of this API (Http client builder implementations) to do an explicit cast.

__Modification__

Improve generics of `LoadBalancerFactory#newLoadBalancer()` to infer the returned `LoadBalancer` generics from the passed `ConnectionFactory`

__Result__

No explicit casts while using `LoadBalancerFactory#newLoadBalancer()`.
Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! ❤️

@NiteshKant NiteshKant merged commit f4d6a63 into apple:master Jun 15, 2020
@NiteshKant NiteshKant deleted the lb-generics branch June 15, 2020 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants