This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 4682f96  Post event after rule configuration was cached (#8881)
4682f96 is described below

commit 4682f969bbce16f36cbf2b14560057a4b64bcb18
Author: Haoran Meng <[email protected]>
AuthorDate: Mon Jan 4 18:12:47 2021 +0800

    Post event after rule configuration was cached (#8881)
---
 .../shardingsphere/governance/core/config/ConfigCenter.java       | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/config/ConfigCenter.java
 
b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/config/ConfigCenter.java
index b3b9d1e..9537f28 100644
--- 
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/config/ConfigCenter.java
+++ 
b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/config/ConfigCenter.java
@@ -25,6 +25,7 @@ import com.google.common.eventbus.Subscribe;
 import 
org.apache.shardingsphere.encrypt.algorithm.config.AlgorithmProvidedEncryptRuleConfiguration;
 import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
 import 
org.apache.shardingsphere.governance.core.event.model.datasource.DataSourcePersistEvent;
+import 
org.apache.shardingsphere.governance.core.event.model.rule.RuleConfigurationsAlteredEvent;
 import 
org.apache.shardingsphere.governance.core.event.model.rule.RuleConfigurationsPersistEvent;
 import 
org.apache.shardingsphere.governance.core.event.model.rule.SwitchRuleConfigurationEvent;
 import 
org.apache.shardingsphere.governance.core.event.model.schema.SchemaNamePersistEvent;
@@ -238,7 +239,12 @@ public final class ConfigCenter {
     }
     
     private void cacheRuleConfigurations(final String schemaName, final 
Collection<RuleConfiguration> ruleConfigurations) {
-        configCacheManager.cache(node.getRulePath(schemaName), 
YamlEngine.marshal(createYamlRootRuleConfigurations(schemaName, 
ruleConfigurations)));
+        String cacheId = 
configCacheManager.cache(node.getRulePath(schemaName), 
YamlEngine.marshal(createYamlRootRuleConfigurations(schemaName, 
ruleConfigurations)));
+        RuleConfigurationsAlteredEvent event = new 
RuleConfigurationsAlteredEvent(schemaName,
+                repository.get(node.getDataSourcePath(schemaName)),
+                repository.get(node.getRulePath(schemaName)),
+                configCacheManager.loadCache(node.getRulePath(schemaName), 
cacheId), cacheId);
+        ShardingSphereEventBus.getInstance().post(event);
     }
     
     private void checkDataSources(final String schemaName, final 
Collection<ReplicaQueryDataSourceRuleConfiguration> dataSources) {

Reply via email to