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

Refactor reload (2) #1790

Merged
merged 3 commits into from
Nov 8, 2024
Merged

Refactor reload (2) #1790

merged 3 commits into from
Nov 8, 2024

Conversation

wind57
Copy link
Contributor

@wind57 wind57 commented Nov 8, 2024

No description provided.

/**
* used for the event based reloading.
*/
public static boolean reload(String target, String sourceAsString, PropertySourceLocator locator,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to achieve a very simple thing here : only two single "entry points" into this class. Only two public methods that both polling and event based reload should call, nothing else should be public. And they do exactly the same thing

List<? extends MapPropertySource> existingSources = findPropertySources(existingSourcesType, environment);

if (existingSources.isEmpty()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am adding this code:

if (existingSources.isEmpty()) {
			LOG.debug(() -> "no existingSources found, reload will not happen");
            return false;
}

This was actually already part of the polling code, but not from the event based one. So this aligns them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this PR can only be created once you are OK with this one and it ends up in main...

*/
@Deprecated(forRemoval = false)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

since this is public already, I can't make it package private, but I will create a PR that will make it such for the next major release

@wind57 wind57 changed the title Refactor reload Refactor reload (3) Nov 8, 2024
@wind57 wind57 changed the title Refactor reload (3) Refactor reload (2) Nov 8, 2024
if (!currentConfigMapSources.isEmpty()) {
changedConfigMap = changed(locateMapPropertySources(this.propertySourceLocator, this.environment),
currentConfigMapSources);
boolean changedConfigMap = ConfigReloadUtil.reload(propertySourceLocator, environment, propertySourceClass);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

instead of calling : findPropertySources, then locateMapPropertySources, we now call reload, that internally does the same thing

@wind57 wind57 marked this pull request as ready for review November 8, 2024 17:48
@wind57
Copy link
Contributor Author

wind57 commented Nov 8, 2024

@ryanjbaxter this one is ready to be looked at too. (I have two PRs open) Thank you!

@ryanjbaxter ryanjbaxter added this to the 3.1.4 milestone Nov 8, 2024
@ryanjbaxter ryanjbaxter merged commit 19ee913 into spring-cloud:3.1.x Nov 8, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants