-
Notifications
You must be signed in to change notification settings - Fork 116
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
#457 add a section to make dynamic config source more visible #478
#457 add a section to make dynamic config source more visible #478
Conversation
Signed-off-by: Emily Jiang <emijiang6@googlemail.com>
@ConfigProperty(name="myprj.some.dynamic.timeout", defaultValue="100") | ||
private javax.inject.Provider<Long> timeout; | ||
---- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also mention that whether a ConfigSource
supports this dynamic behavior or not is dependent on how it's implemented.
Need to make clear there's no guarantee as to whether any ConfigSource
does, or does not, support this dynamic behavior and that it's a case by case basis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that calling out dynamic config sources is exactly the opposite of what we agreed on last week's call. Since there's nothing we can do about the dynamicity of a given config source, we agreed not to specify whether or not it is dynamic, but instead only impose thread-safety requirements on the property names collection(s) and iterator(s).
Signed-off-by: Emily Jiang <emijiang6@googlemail.com>
@dmlloyd Since the spec already supported dynamic behaviour and having tck to verify this. I think it is a good idea to clarify this. I did add a few sentences as per @kenfinnigan 's comments. As for the thread-safety, I think we were more in the context of whether all properties appear in |
|
||
Whether a `ConfigSource` supports this dynamic behavior or not is dependent on how it's implemented. | ||
For an instance, the default `ConfigSource` microprofile-config.properties and Environment Variables are not dynamic | ||
while System Properties are dynamic by nature. MicroProfile Config Implementation can decide whether |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"MicroProfile Config Implementation [sic] can decide whether a ConfigSource
can be dynamic or not": I find this hard to understand. ConfigSource
s can be packaged with applications. How can a given MicroProfile Config implementation "decide" whether a ConfigSource
packaged with an application is dynamic or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ljnelson it somewhat depends on whether a ConfigSource
implementation using a backing source that could be updated.
@Emily-Jiang I'm not sure we can say "System Properties are dynamic by nature". Is there a requirement in the spec that the System Property ConfigSource
an implementation includes doesn't copy the entire set of properties into an internal map on creation? If it does a copy, then System Property isn't dynamic as adding a new one won't appear in that ConfigSource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenfinnigan Not trying to be difficult, but again: how is, say, an OpenLiberty MicroProfile Config implementation shipped with an application server supposed to "know" that my ConfigSource
implementation—the one in my application deployed to that server—is dynamic? It cannot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, see your point now.
So yes, an MP Config implementation can only "know" whether the ConfigSource
s it provides are dynamic or not. There is no way for it to "know" about any ConfigSource
that is included within the application code directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. In other words: what is the contract of ConfigSource#getPropertyNames()
? It is so underspecified as to be almost useless, viz. is the returned Set
an immutable snapshot? A mutating snapshot? Is it thread safe (i.e. what must I do to iterate over it)? If I call the method two times must I get back equal Set
s? Identical Set
s? And so on. (And that's before even considering the ConfigSource#getProperties()
method, which suffers from the same kind of lack of specificity.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, and not just TCK tests: this is a public API exposed to the end user. She cannot use it because she does not know how to use the returned Set
. Must she synchronize on it? Or not? Can she cache it? And so on. We are in agreement here at a high level that there is much more work to be done here, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that there is still lots to be done.
In terms of this PR, I'm wondering if we need to go back to discussing improving the definitions of the API first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ljnelson I was going to add a PR to say the getPropertyNames() can be iterated in a thread safe manner based on the suggestion from @dmlloyd
@kenfinnigan there is a TCK to verify the dynamic aspect of system property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's a good start. An even better start would be to make sure that the iteration is fully specified. See the Concurrent Collections section in the package description of the java.util.concurrent
package documentation for a particularly good example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow up on what I mentioned the following tcks to assert dynamic config lookup.
ConfigProviderTest.testDynamicValueInPropertyConfigSource()
ConfigProviderTest.testGetPropertyNames()
ConfigProviderTest.testPropertyConfigSource()
EmptyValuesTest.testEmptyStringProgrammaticLookup()
Is this still current, given the recent spec updates? |
I think this is still relevant as the spec still supports dynamic configsources. It worths the clarification. |
…ly-Jiang/microprofile-config into dynamic-config-clarification
f927fa7
to
86b6057
Compare
I would like to merge this PR by 15th July as I have answered all questions and have got 2 approvals. Please log your comments asap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some typos need to be fixed.
Signed-off-by: Emily Jiang <emijiang6@googlemail.com>
@radcortez I have done all of the tidy up including the format. Please double check and approve if no more comments. |
We probably need for @ljnelson to check the latest update to see if it addresses his comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@radcortez I've addressed all of your comments! Please check again.
@ljnelson can you double check to see whether this PR has addressed your issue? |
It is written:
With respect, that is not grammatically correct. Nor does it indicate who is doing the updating: a naïve user might very well see "its content can be updated" and start looking for an I think instead you're trying to say something about the dynamism of the data that underlies any given In other words, I think you might be trying to say something as simple as this (and indeed maybe the whole PR comes down to a couple of sentences): "A That is just a suggestion. (I sense some sudden urgency to this PR for some reason so I won't stand in the way of whatever you want to do.) |
@ljnelson the urgency is because there is planned RC release of MP platform by 1st week of August, so all individuals specs should have their RC's ready as well. I like your text better, so I think we can modify it to better express the view. Cheers! |
Signed-off-by: Emily Jiang <emijiang6@googlemail.com>
@ljnelson I have updated the sentences in question with your suggested text with slight modification. Please double check to see whether you have any further comments. |
@ljnelson I'll merge this PR by COB today if I don't hear more feedback from you today. |
Signed-off-by: Emily Jiang emijiang6@googlemail.com