Skip to content

Commit

Permalink
Refactor ClusterContextManagerBuilder (#31234)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored May 15, 2024
1 parent d5e1653 commit 18414e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
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;

Expand Down Expand Up @@ -81,7 +80,6 @@ private void registerOnline(final RegistryCenter registryCenter, final ContextMa
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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@
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.
*/
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),
Expand Down

0 comments on commit 18414e5

Please sign in to comment.