提交 e7b84df1 编写于 作者: T terrymanu

update ProxyOrchestrationSchemaContexts

上级 aa1502f7
......@@ -34,8 +34,7 @@ import java.util.Map;
import java.util.Map.Entry;
/**
* Proxy control panel subscriber.
*
* Proxy orchestration schema contexts.
*/
public final class ProxyOrchestrationSchemaContexts extends OrchestrationSchemaContexts {
......@@ -55,7 +54,7 @@ public final class ProxyOrchestrationSchemaContexts extends OrchestrationSchemaC
@Override
protected Map<String, DataSource> getModifiedDataSources(final SchemaContext oldSchemaContext, final Map<String, DataSourceConfiguration> newDataSources) throws Exception {
Map<String, DataSourceParameter> newDataSourceParameters = DataSourceConverter.getDataSourceParameterMap(newDataSources);
Map<String, DataSourceParameter> parameters = new LinkedHashMap<>();
Map<String, DataSourceParameter> parameters = new LinkedHashMap<>(newDataSourceParameters.size(), 1);
for (Entry<String, DataSourceParameter> entry : newDataSourceParameters.entrySet()) {
if (isModifiedDataSource(oldSchemaContext.getSchema().getDataSources(), entry.getKey(), entry.getValue())) {
parameters.put(entry.getKey(), entry.getValue());
......@@ -70,15 +69,16 @@ public final class ProxyOrchestrationSchemaContexts extends OrchestrationSchemaC
@Override
protected Map<String, Map<String, DataSource>> createDataSourcesMap(final Map<String, Map<String, DataSourceConfiguration>> dataSourcesMap) throws Exception {
Map<String, Map<String, DataSource>> result = new LinkedHashMap<>();
for (Entry<String, Map<String, DataSourceParameter>> entry : createDataSourceParametersMap(dataSourcesMap).entrySet()) {
Map<String, Map<String, DataSourceParameter>> dataSourceParametersMap = createDataSourceParametersMap(dataSourcesMap);
Map<String, Map<String, DataSource>> result = new LinkedHashMap<>(dataSourceParametersMap.size(), 1);
for (Entry<String, Map<String, DataSourceParameter>> entry : dataSourceParametersMap.entrySet()) {
result.put(entry.getKey(), createDataSources(entry.getValue()));
}
return result;
}
private Map<String, DataSource> createDataSources(final Map<String, DataSourceParameter> dataSourceParameters) throws Exception {
Map<String, DataSource> result = new LinkedHashMap<>();
Map<String, DataSource> result = new LinkedHashMap<>(dataSourceParameters.size(), 1);
for (Entry<String, DataSourceParameter> entry: dataSourceParameters.entrySet()) {
result.put(entry.getKey(), backendDataSourceFactory.build(entry.getKey(), entry.getValue()));
}
......@@ -87,7 +87,7 @@ public final class ProxyOrchestrationSchemaContexts extends OrchestrationSchemaC
@Override
public Map<String, Map<String, DataSourceParameter>> createDataSourceParametersMap(final Map<String, Map<String, DataSourceConfiguration>> dataSources) {
Map<String, Map<String, DataSourceParameter>> result = new LinkedHashMap<>();
Map<String, Map<String, DataSourceParameter>> result = new LinkedHashMap<>(dataSources.size(), 1);
for (Entry<String, Map<String, DataSourceConfiguration>> entry : dataSources.entrySet()) {
result.put(entry.getKey(), DataSourceConverter.getDataSourceParameterMap(entry.getValue()));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册