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

menghaoran 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 dea4eac73fa Refactor ClusterContextManagerBuilder (#31335)
dea4eac73fa is described below

commit dea4eac73faf7d5d5a9d7a946257f983be6e2c91
Author: Liang Zhang <[email protected]>
AuthorDate: Wed May 22 00:05:56 2024 +0800

    Refactor ClusterContextManagerBuilder (#31335)
---
 .../mode/manager/cluster/ClusterContextManagerBuilder.java           | 5 +++--
 1 file changed, 3 insertions(+), 2 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 b478531f2a3..89e189e6309 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
@@ -112,13 +112,14 @@ public final class ClusterContextManagerBuilder 
implements ContextManagerBuilder
     
     private void registerOnline(final EventBusContext eventBusContext, final 
ComputeNodeInstanceContext computeNodeInstanceContext,
                                 final ClusterPersistRepository repository, 
final ContextManagerBuilderParameter param, final ContextManager 
contextManager) {
-        new 
ComputeNodeStatusService(repository).registerOnline(computeNodeInstanceContext.getInstance());
+        ComputeNodeStatusService computeNodeStatusService = new 
ComputeNodeStatusService(repository);
+        
computeNodeStatusService.registerOnline(computeNodeInstanceContext.getInstance());
         new GovernanceWatcherFactory(repository,
                 eventBusContext, param.getInstanceMetaData() instanceof 
JDBCInstanceMetaData ? param.getDatabaseConfigs().keySet() : 
Collections.emptyList()).watchListeners();
         if (null != param.getLabels()) {
             
contextManager.getComputeNodeInstanceContext().getInstance().getLabels().addAll(param.getLabels());
         }
-        
contextManager.getComputeNodeInstanceContext().getAllClusterInstances().addAll(new
 ComputeNodeStatusService(repository).loadAllComputeNodeInstances());
+        
contextManager.getComputeNodeInstanceContext().getAllClusterInstances().addAll(computeNodeStatusService.loadAllComputeNodeInstances());
         new ClusterEventSubscriberRegistry(contextManager, 
repository).register();
     }
     

Reply via email to