-
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
Refactor #384 #403
Refactor #384 #403
Conversation
@Emily-Jiang this is the same PR that #398 but for master . |
Update the onAttributeChange method to return a ChangeSupport class that can be used to handle release of resources (in the close method). When a Config is released, it should call ChangeSupport.close to ensure that the ConfigSource has a chance to properly release any resources held by the callbacks. * Add TCK test ConfigAccessorTest#testOnAttributeChange Signed-off-by: Jeff Mesnil <[email protected]>
d56d062
to
7183da6
Compare
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.
LGTM!
This is a duplicated mechanism now, isn't? |
@@ -196,6 +196,21 @@ public void testCacheFor() throws Exception { | |||
Assert.assertEquals(val.getValue(), "secondvalue"); | |||
} | |||
|
|||
@Test |
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.
This test seems weird, what should it actually do?
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.
the test checks that when the config source change the property value, the config is properly notified and the value from the ConfigAccessor is invalidated and fetch from the config source again.
I should have put a longer cache duration to make it clearer.
Of course, when the |
But why all that? what is the reason? The Config can already close all the ConfigSources, so what was missing? I still don't get that! We have a ticket text which describes which code changes you do. But that's completely redundant to the code itself. What is missing is the WHY! WHY did you do that change. This is not apparent to me. Could you help me to understand the reason? I'd rather stick with KISS... |
A When a |
That's not correct. A If a |
No Jeff, A Having a shared Configuration is the exceptional case. So we should not make it more complicated for the standard use case. |
Maybe we should write that down in the spec instead of repeating it a 13 times. By construction, the |
It is technical possible, but it is not intended. |
I think Mark is right and this change should be reverted since it doesnt bring anything not already doable before. Also the test does not sound accurate too. Also agree to enforce spec wording if you think it is not already the case, any natuve or well speaking person able to help? |
I'm ok with reverting the change provided it is clearly written in the spec (or the As for the test, there was 0 tests for this feature in the original PR. Any contribution to add or improve tests that verifies this feature is welcome. |
A config source with update feature only but the wording update makes sense. Probably with something like "otherwise the behavior is up to the impl". |
Update the onAttributeChange method to return a ChangeSupport class that
can be used to handle release of resources (in the close method).
When a Config is released, it should call ChangeSupport.close to ensure
that the ConfigSource has a chance to properly release any resources
held by the callbacks.
Signed-off-by: Jeff Mesnil [email protected]