Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
public final class AuthorityRuleManager {

private static Map<String, Set<AuthorityRule>> authorityRules = new ConcurrentHashMap<>();
private static volatile Map<String, Set<AuthorityRule>> authorityRules = new ConcurrentHashMap<>();

private static final RulePropertyListener LISTENER = new RulePropertyListener();
private static SentinelProperty<List<AuthorityRule>> currentProperty = new DynamicSentinelProperty<>();
Expand Down Expand Up @@ -93,12 +93,8 @@ private static class RulePropertyListener implements PropertyListener<List<Autho

@Override
public void configUpdate(List<AuthorityRule> conf) {
Map<String, Set<AuthorityRule>> rules = loadAuthorityConf(conf);

authorityRules.clear();
if (rules != null) {
authorityRules.putAll(rules);
}
authorityRules = loadAuthorityConf(conf);

RecordLog.info("[AuthorityRuleManager] Authority rules received: {}", authorityRules);
}

Expand Down Expand Up @@ -137,12 +133,8 @@ private Map<String, Set<AuthorityRule>> loadAuthorityConf(List<AuthorityRule> li

@Override
public void configLoad(List<AuthorityRule> value) {
Map<String, Set<AuthorityRule>> rules = loadAuthorityConf(value);
authorityRules = loadAuthorityConf(value);

authorityRules.clear();
if (rules != null) {
authorityRules.putAll(rules);
}
RecordLog.info("[AuthorityRuleManager] Load authority rules: {}", authorityRules);
}
}
Expand Down