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

loadbalancer-experimental: javadoc cleanup and minor fixes #3138

Merged
merged 4 commits into from
Dec 14, 2024

Conversation

idelpivnitskiy
Copy link
Member

@idelpivnitskiy idelpivnitskiy commented Dec 13, 2024

Minor adjustments to indentation, validation, formatting, in code and javadoc.
Also reduced visibility where it was possible. Even if those methods are currently in pkg-private classes, it may help to start with minimal visibility on methods to avoid accidental API leaks when we make classes public in the future.

Minor adjustments to indentation, validation, formatting, in code and
javadoc.
@idelpivnitskiy idelpivnitskiy self-assigned this Dec 13, 2024
Copy link
Member Author

@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.

I will use this PR to open more discussions in result of my findings but these comments don't have to result in more changes in this PR, everything can be done in a follow-up:

@@ -17,6 +17,9 @@

import io.servicetalk.client.api.LoadBalancedConnection;

/**
* A factory to create different {@link ConnectionPoolPolicy} variants.
*/
public final class ConnectionPoolPolicies {
Copy link
Member Author

Choose a reason for hiding this comment

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

Open thread for naming discussion (disclaimer: naming is hard):

The way currently javadoc is written around ConnectionPoolPolicy is that it's responsible for selection logic, not really for "pooling". It might be slightly more aligned if we rename it to ConnectionSelectionPolicy or ConnectionSelectorPolicy. That will highlight that it is only responsible for selecting from the pool (but not how to pool bcz it may imply internal data structure) and the fact it returns ConnectionSelector.

On the other hand, we can keep it as-is for now and rename when we are ready to introduce a public interface instead of an abstract class that we will be able to deprecate. So, if you promise me we will go from abstract class to an interface later, I would like to save new name proposal for the future 😄

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think what you're proposing is that if we keep the abstract class and introduce an interface later we can use the good name (ConnectionSelectionPolicy) for the interface. Eg, not trying to convert the abstract class to an interface which I'm not sure is considered API compatible. Maybe it is since there is no way for users to create one, but otoh I'm not sure.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, if we don't allow users create their own implementations there is almost 0 risk to break them when we change from an abstract class to an interface. My only worry is that if someone releases a library that references ConnectionPoolPolicy and assigns it to a variable, will that library work without recompilation with the next version of ST if we change it to an interface? I don't remember binary compatibility rules in this case.

@@ -16,7 +16,7 @@
package io.servicetalk.loadbalancer;

/**
* A collections of factories for constructing a {@link LoadBalancingPolicy}.
* A factory to create different {@link LoadBalancingPolicy} variants.
*/
public final class LoadBalancingPolicies {
Copy link
Member Author

Choose a reason for hiding this comment

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

Similar thought on renaming LoadBalancingPolicy. However here I really like the current name and don't have good ideas for a new name when we are ready to go from an abstract class to an interface.

Copy link
Contributor

@bryce-anderson bryce-anderson left a comment

Choose a reason for hiding this comment

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

Thank you for the cleanups @idelpivnitskiy!

@@ -17,6 +17,9 @@

import io.servicetalk.client.api.LoadBalancedConnection;

/**
* A factory to create different {@link ConnectionPoolPolicy} variants.
*/
public final class ConnectionPoolPolicies {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think what you're proposing is that if we keep the abstract class and introduce an interface later we can use the good name (ConnectionSelectionPolicy) for the interface. Eg, not trying to convert the abstract class to an interface which I'm not sure is considered API compatible. Maybe it is since there is no way for users to create one, but otoh I'm not sure.

Copy link
Contributor

@bryce-anderson bryce-anderson left a comment

Choose a reason for hiding this comment

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

Thanks again for the great attention to detail. 🎖️

@idelpivnitskiy idelpivnitskiy merged commit 9924380 into apple:main Dec 14, 2024
11 checks passed
@idelpivnitskiy idelpivnitskiy deleted the loadbalancer-experimental branch December 14, 2024 00:01
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