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

SCB-315 Config Center module can't get config by DynamicPropertyFacto… #546

Merged
merged 3 commits into from Feb 3, 2018

Conversation

jeho0815
Copy link
Contributor

@jeho0815 jeho0815 commented Feb 2, 2018

…ry.getInstance().getStringProperty, so has to use ConcurrentCompositeConfiguration

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SCB-XXX] Fixes bug in ApproximateQuantiles, where you replace SCB-XXX with the appropriate JIRA issue.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

…ry.getInstance().getStringProperty, so has to use ConcurrentCompositeConfiguration
@coveralls
Copy link

coveralls commented Feb 2, 2018

Coverage Status

Coverage decreased (-0.02%) to 87.295% when pulling 4eb6af5 on jeho0815:Branch_SCB-315 into 769dc9d on apache:master.

"addressResolver." + tag + ".rotateServers",
"addressResolver.rotateServers"));
return addressResolverOptions;
}

private static List<String> getStringListProperty(List<String> defaultValue, String... keys) {
private static List<String> getStringListProperty(ConcurrentCompositeConfiguration configSource,
List<String> defaultValue, String... keys) {
String property = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

if configSource is null, then assign from DynamicPropertyFactory.getBackingConfigurationSource()
then return Arrays.asList(configSource.getStringArray(key))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@@ -95,33 +127,55 @@ public static AddressResolverOptions getAddressResover(String tag) {
}
}

private static int getIntProperty(int defaultValue, String... keys) {
private static int getIntProperty(ConcurrentCompositeConfiguration configSource, int defaultValue, String... keys) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we can make the logics simpler

…ry.getInstance().getStringProperty, so has to use ConcurrentCompositeConfiguration
if (property > 0) {
break;
Integer val = configSource.getInteger(key, null);
if (val != null && val > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why a value <=0 is invalid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all integer parameters must large than zero

Copy link
Contributor

Choose a reason for hiding this comment

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

1.if there is some property have no this limit
and developers see there is a getIntProperty method, invoke it directly......

2.users make a wrong configuration, here ignore the wrong value, and use default value
but this behavior is silence
nobody know what happened.

…ry.getInstance().getStringProperty, so has to use ConcurrentCompositeConfiguration
@WillemJiang WillemJiang merged commit 153cdeb into apache:master Feb 3, 2018
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.

None yet

4 participants