shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinator.java
/**
     * Renew primary data source names.
     *
     * @param event primary state changed event
     */
Renew primary data source names.
@param event primary state changed event
Renew primary data source names . @param event primary state changed event
@Subscribe
    public synchronized void renew(final PrimaryStateChangedEvent event) {
        QualifiedSchema qualifiedSchema = event.getQualifiedSchema();
        Collection<ShardingSphereRule> rules = contextManager.getMetaDataContexts().getMetaDataMap().get(qualifiedSchema.getSchemaName()).getRuleMetaData().getRules();
        for (ShardingSphereRule each : rules) {
            if (each instanceof StatusContainedRule) {
                ((StatusContainedRule) each).updateStatus(new PrimaryDataSourceChangedEvent(qualifiedSchema.getSchemaName(), qualifiedSchema.getDataSourceName(), event.getPrimaryDataSourceName()));
            }
        }
    }
@ Subscribe public synchronized void renew ( final PrimaryStateChangedEvent event ) { QualifiedSchema qualifiedSchema = event . getQualifiedSchema ( ) ; Collection < ShardingSphereRule > rules = contextManager . getMetaDataContexts ( ) . getMetaDataMap ( ) . get ( qualifiedSchema . getSchemaName ( ) ) . getRuleMetaData ( ) . getRules ( ) ; for ( ShardingSphereRule each : rules ) { if ( each instanceof StatusContainedRule ) { ( ( StatusContainedRule ) each ) . updateStatus ( new PrimaryDataSourceChangedEvent ( qualifiedSchema . getSchemaName ( ) , qualifiedSchema . getDataSourceName ( ) , event . getPrimaryDataSourceName ( ) ) ) ; } } }
Renew primary data source names.
Renew primary data source names .