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: add LB observer method for when the host set changes #3003

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public void onHostSetChanged(Collection<? extends Host> newHosts) {
healthyCount++;
}
}
LOGGER.debug("{}- onHostSetChanged(total: {}, healthy: {})", lbDescription, newHosts.size(), healthyCount);
LOGGER.debug("{}- onHostSetChanged(newHosts: {}). Size: {}, healthy: ", lbDescription, newHosts,
newHosts.size(), healthyCount);
bryce-anderson marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ private void sequentialUpdateUsedHosts(List<PrioritizedHostImpl<ResolvedAddress,
}
nextHosts = priorityStrategy.prioritize(nextHosts);
this.hostSelector = hostSelector.rebuildWithHosts(nextHosts);
loadBalancerObserver.onHostSetChanged(nextHosts);
loadBalancerObserver.onHostSetChanged(Collections.unmodifiableCollection(nextHosts));
Copy link
Member

Choose a reason for hiding this comment

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

After the 2nd look: priorityStrategy returns a List. Why does the observer provide a Collection? Just to align with SD discovery publisher contract? Will List be beneficial to signal Host priorities to users of LB-observer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We talked offline and the static type of Collection is fine and I've used the unmodifiableList method to make the dynamic type more helpful.

}

@Override
Expand Down
Loading