-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
feat(apollo-client): add method interestedChangedKeys to ConfigChangeEvent #3666
Merged
nobodyiam
merged 20 commits into
apolloconfig:master
from
Anilople:feature/interested/key/20210508
Jun 11, 2021
Merged
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
817c9a7
feat(apollo-client): add method interestedChangedKeys to ConfigChange…
Anilople 2b28a27
docs: add Apache LICENSE-2.0
Anilople 1e40d80
fix(apollo-client): null exception
Anilople 2dda71b
Merge branch 'master' into feature/interested/key/20210508
nobodyiam 67d49bc
Merge branch 'master' into feature/interested/key/20210508
Anilople 835823d
delete getChanges in ConfigChangeEvent
Anilople e6c20a0
docs: update LICENSE
Anilople 66d59ee
feat: use InterestedConfigChangeEvent
Anilople cca7e5b
revert a test back
Anilople 0ce9957
test: interested key config change event
Anilople 428f461
Merge branch 'master' into feature/interested/key/20210508
Anilople a3a5cfa
test: add another key
Anilople c475174
Merge branch 'feature/interested/key/20210508' of https://github.com/…
Anilople 2880a4f
Update CHANGES.md
Anilople 3064aaf
Merge branch 'master' into feature/interested/key/20210508
Anilople e78a706
feat: fireConfigChange return how many listener be fired
Anilople 259cda1
test: expose bug in fireConfigChange
Anilople cd30d53
fix: notify multiple time if exists multiple listener
Anilople 5759735
feat: move InterestedConfigChangeEvent, it cannot be use by other pac…
Anilople 479a5d2
rollback fireConfigChange return type to 'void'
Anilople File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...lient/src/main/java/com/ctrip/framework/apollo/internals/InterestedConfigChangeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2021 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.internals; | ||
|
||
import com.ctrip.framework.apollo.Config; | ||
import com.ctrip.framework.apollo.ConfigChangeListener; | ||
import com.ctrip.framework.apollo.model.ConfigChange; | ||
import com.ctrip.framework.apollo.model.ConfigChangeEvent; | ||
import com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* In {@link ApolloConfigChangeListener} you set some interested key's rule, you can get those keys | ||
* by this class's instance. | ||
* | ||
* @author wxq | ||
*/ | ||
class InterestedConfigChangeEvent extends ConfigChangeEvent { | ||
nobodyiam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* @see Config#addChangeListener(ConfigChangeListener, Set) | ||
* @see Config#addChangeListener(ConfigChangeListener, Set, Set) | ||
* @see ApolloConfigChangeListener#interestedKeys() | ||
* @see ApolloConfigChangeListener#interestedKeyPrefixes() | ||
*/ | ||
private final Set<String> m_interestedChangedKeys; | ||
|
||
public InterestedConfigChangeEvent(String namespace, | ||
Map<String, ConfigChange> changes, Set<String> interestedChangedKeys) { | ||
super(namespace, changes); | ||
this.m_interestedChangedKeys = interestedChangedKeys; | ||
} | ||
|
||
/** | ||
* @return interested and changed keys | ||
*/ | ||
@Override | ||
public Set<String> interestedChangedKeys() { | ||
return Collections.unmodifiableSet(this.m_interestedChangedKeys); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Will it break the compability when change return type from
void
toint
?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 it will, since this method is protected, users may have overridden it