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

yx9o 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 18414e52542 Refactor ClusterContextManagerBuilder (#31234)
18414e52542 is described below

commit 18414e52542a3ffdf7133503c86aa7b70eadd83d
Author: Liang Zhang <[email protected]>
AuthorDate: Wed May 15 23:49:35 2024 +0800

    Refactor ClusterContextManagerBuilder (#31234)
---
 .../mode/manager/cluster/ClusterContextManagerBuilder.java           | 2 --
 .../coordinator/subscriber/ClusterEventSubscriberRegistry.java       | 5 ++++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
index 703f399cedb..a2f262e71b2 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
@@ -35,7 +35,6 @@ import 
org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
-import org.apache.shardingsphere.mode.subsciber.RuleItemChangedSubscriber;
 
 import java.sql.SQLException;
 
@@ -81,7 +80,6 @@ public final class ClusterContextManagerBuilder implements 
ContextManagerBuilder
         loadClusterStatus(registryCenter, contextManager);
         
contextManager.getInstanceContext().getInstance().setLabels(param.getLabels());
         
contextManager.getInstanceContext().getAllClusterInstances().addAll(registryCenter.getComputeNodeStatusService().loadAllComputeNodeInstances());
-        contextManager.getInstanceContext().getEventBusContext().register(new 
RuleItemChangedSubscriber(contextManager));
         new ClusterEventSubscriberRegistry(contextManager, 
registryCenter).register();
     }
     
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ClusterEventSubscriberRegistry.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ClusterEventSubscriberRegistry.java
index c81a8181e96..67c9d3e90ea 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ClusterEventSubscriberRegistry.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ClusterEventSubscriberRegistry.java
@@ -21,6 +21,7 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.RegistryCenter;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.process.subscriber.ProcessListChangedSubscriber;
 import org.apache.shardingsphere.mode.subsciber.EventSubscriberRegistry;
+import org.apache.shardingsphere.mode.subsciber.RuleItemChangedSubscriber;
 
 /**
  * Cluster event subscriber registry.
@@ -28,7 +29,9 @@ import 
org.apache.shardingsphere.mode.subsciber.EventSubscriberRegistry;
 public final class ClusterEventSubscriberRegistry extends 
EventSubscriberRegistry {
     
     public ClusterEventSubscriberRegistry(final ContextManager contextManager, 
final RegistryCenter registryCenter) {
-        super(contextManager, new 
ConfigurationChangedSubscriber(contextManager),
+        super(contextManager,
+                new RuleItemChangedSubscriber(contextManager),
+                new ConfigurationChangedSubscriber(contextManager),
                 new ConfigurationChangedSubscriber(contextManager),
                 new ResourceMetaDataChangedSubscriber(contextManager),
                 new DatabaseChangedSubscriber(contextManager),

Reply via email to