提交 ed784757 编写于 作者: H haocao

Add orchestration master slave datasource disabled support 11th.

上级 cc1b962b
......@@ -79,7 +79,9 @@ public final class OrchestrationFacade {
instanceStateService.persistShardingInstanceOnline();
dataSourceService.persistDataSourcesNode();
listenerManager.initShardingListeners(shardingDataSource);
shardingDataSource.renew(dataSourceService.getAvailableShardingRule(), props);
if (dataSourceService.hasDisabledDataSource()) {
shardingDataSource.renew(dataSourceService.getAvailableShardingRule(), props);
}
}
private void reviseShardingRuleConfigurationForMasterSlave(final Map<String, DataSource> dataSourceMap, final ShardingRuleConfiguration shardingRuleConfig) {
......@@ -127,6 +129,8 @@ public final class OrchestrationFacade {
instanceStateService.persistMasterSlaveInstanceOnline();
dataSourceService.persistDataSourcesNode();
listenerManager.initMasterSlaveListeners(masterSlaveDataSource);
masterSlaveDataSource.renew(dataSourceService.getAvailableMasterSlaveRule());
if (dataSourceService.hasDisabledDataSource()) {
masterSlaveDataSource.renew(dataSourceService.getAvailableMasterSlaveRule());
}
}
}
......@@ -62,6 +62,26 @@ public final class DataSourceService {
regCenter.addCacheData(dataSourceNodePath);
}
/**
* Justify if has disabled datasource.
*
* @return if has disabled datasouce
*/
public boolean hasDisabledDataSource() {
boolean result = false;
String dataSourcesNodePath = stateNode.getDataSourcesNodeFullPath();
List<String> dataSources = regCenter.getChildrenKeys(dataSourcesNodePath);
for (String each : dataSources) {
String path = dataSourcesNodePath + "/" + each;
if (StateNodeStatus.DISABLED.toString().equalsIgnoreCase(regCenter.get(path))) {
result = true;
}
}
return result;
}
/**
* Get available sharding rule.
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册