You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ki...@apache.org on 2020/07/14 06:19:20 UTC
[shardingsphere] branch master updated: Refactor registry center
instance (#6338)
This is an automated email from the ASF dual-hosted git repository.
kimmking 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 5be9cec Refactor registry center instance (#6338)
5be9cec is described below
commit 5be9cec04f8b363894647164fe4ff74a51307fb5
Author: Haoran Meng <me...@gmail.com>
AuthorDate: Tue Jul 14 14:19:02 2020 +0800
Refactor registry center instance (#6338)
* refactor registry center instance
* revise properties key
* revise properties key
---
.../core/facade/ShardingOrchestrationFacade.java | 4 ++--
.../facade/ShardingOrchestrationFacadeTest.java | 2 +-
.../ShardingOrchestrationListenerManagerTest.java | 2 --
.../core/registrycenter/RegistryCenter.java | 4 ++--
.../instance/OrchestrationInstance.java | 22 ++++++++--------------
.../core/registrycenter/RegistryCenterTest.java | 2 +-
.../listener/InstanceStateChangedListenerTest.java | 2 --
.../listener/RegistryListenerManagerTest.java | 2 --
.../OrchestrationShardingSphereDataSource.java | 13 ++++---------
.../org/apache/shardingsphere/proxy/Bootstrap.java | 5 ++++-
.../converter/DefaultConfigurationConverter.java | 2 +-
.../converter/ProxyConfigurationConverter.java | 3 +--
.../OrchestrationConfigurationConverter.java | 4 ++--
13 files changed, 26 insertions(+), 41 deletions(-)
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/ShardingOrchestrationFacade.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/ShardingOrchestrationFacade.java
index 87551b4..9c88f84 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/ShardingOrchestrationFacade.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/ShardingOrchestrationFacade.java
@@ -81,7 +81,7 @@ public final class ShardingOrchestrationFacade implements AutoCloseable {
private final ShardingOrchestrationListenerManager listenerManager;
- public ShardingOrchestrationFacade(final OrchestrationConfiguration orchestrationConfig, final Collection<String> shardingSchemaNames, final String instanceTag) {
+ public ShardingOrchestrationFacade(final OrchestrationConfiguration orchestrationConfig, final Collection<String> shardingSchemaNames) {
Optional<String> configCenterName = getInstanceNameByOrchestrationType(orchestrationConfig.getInstanceConfigurationMap(), CenterType.CONFIG_CENTER.getValue());
Preconditions.checkArgument(configCenterName.isPresent(), "Can not find instance configuration with config center orchestration type.");
CenterConfiguration configCenterConfiguration = orchestrationConfig.getInstanceConfigurationMap().get(configCenterName.get());
@@ -97,7 +97,7 @@ public final class ShardingOrchestrationFacade implements AutoCloseable {
Preconditions.checkNotNull(registryCenterConfiguration, "Registry center configuration cannot be null.");
registryCenterRepository = TypedSPIRegistry.getRegisteredService(RegistryCenterRepository.class, registryCenterConfiguration.getType(), registryCenterConfiguration.getProps());
registryCenterRepository.init(registryCenterConfiguration);
- registryCenter = new RegistryCenter(registryCenterName.get(), instanceTag, registryCenterRepository);
+ registryCenter = new RegistryCenter(registryCenterName.get(), registryCenterRepository);
Optional<String> metaDataCenterName = getInstanceNameByOrchestrationType(orchestrationConfig.getInstanceConfigurationMap(), CenterType.METADATA_CENTER.getValue());
Preconditions.checkArgument(metaDataCenterName.isPresent(), "Can not find instance configuration with metadata center orchestration type.");
CenterConfiguration metaDataCenterConfiguration = orchestrationConfig.getInstanceConfigurationMap().get(metaDataCenterName.get());
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/ShardingOrchestrationFacadeTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/ShardingOrchestrationFacadeTest.java
index e3bacc4..c9ae741 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/ShardingOrchestrationFacadeTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/ShardingOrchestrationFacadeTest.java
@@ -83,7 +83,7 @@ public final class ShardingOrchestrationFacadeTest {
configuration3.setNamespace("namespace_3");
instanceConfigurationMap.put("test_name_3", configuration3);
OrchestrationConfiguration orchestrationConfiguration = new OrchestrationConfiguration(instanceConfigurationMap);
- shardingOrchestrationFacade = new ShardingOrchestrationFacade(orchestrationConfiguration, Arrays.asList("sharding_db", "masterslave_db"), "3307");
+ shardingOrchestrationFacade = new ShardingOrchestrationFacade(orchestrationConfiguration, Arrays.asList("sharding_db", "masterslave_db"));
FieldUtil.setField(shardingOrchestrationFacade, "registryCenterRepository", registryCenterRepository);
FieldUtil.setField(shardingOrchestrationFacade, "configCenter", configCenter);
FieldUtil.setField(shardingOrchestrationFacade, "registryCenter", registryCenter);
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/ShardingOrchestrationListenerManagerTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/ShardingOrchestrationListenerManag [...]
index 01f8103..ad1d690 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/ShardingOrchestrationListenerManagerTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/ShardingOrchestrationListenerManagerTest.java
@@ -24,7 +24,6 @@ import org.apache.shardingsphere.orchestration.core.configcenter.listener.Config
import org.apache.shardingsphere.orchestration.core.facade.listener.ShardingOrchestrationListenerManager;
import org.apache.shardingsphere.orchestration.core.facade.util.FieldUtil;
import org.apache.shardingsphere.orchestration.core.metadatacenter.listener.MetaDataListenerManager;
-import org.apache.shardingsphere.orchestration.core.registrycenter.instance.OrchestrationInstance;
import org.apache.shardingsphere.orchestration.core.registrycenter.listener.RegistryListenerManager;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -55,7 +54,6 @@ public final class ShardingOrchestrationListenerManagerTest {
@Test
public void assertInitListeners() {
- OrchestrationInstance.init("3307");
ShardingOrchestrationListenerManager actual = new ShardingOrchestrationListenerManager("testRegCenter", registryCenterRepository,
"FirstTestConfigCenter", configCenterRepository,
"FirstTestConfigCenter", configCenterRepository, Collections.emptyList());
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/RegistryCenter.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/RegistryCenter.java
index e722f28..4b8fede 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/RegistryCenter.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/RegistryCenter.java
@@ -35,10 +35,10 @@ public final class RegistryCenter {
private final OrchestrationInstance instance;
- public RegistryCenter(final String name, final String instanceTag, final RegistryCenterRepository registryCenterRepository) {
+ public RegistryCenter(final String name, final RegistryCenterRepository registryCenterRepository) {
this.node = new RegistryCenterNode(name);
this.repository = registryCenterRepository;
- this.instance = OrchestrationInstance.init(instanceTag);
+ this.instance = OrchestrationInstance.getInstance();
}
/**
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/instance/OrchestrationInstance.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/instance/Orc [...]
index 30b067c..df51e3f 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/instance/OrchestrationInstance.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/instance/OrchestrationInstance.java
@@ -17,7 +17,10 @@
package org.apache.shardingsphere.orchestration.core.registrycenter.instance;
+import java.lang.management.ManagementFactory;
import java.util.UUID;
+
+import com.google.common.base.Strings;
import org.apache.shardingsphere.orchestration.core.common.utils.IpUtils;
/**
@@ -29,10 +32,14 @@ public final class OrchestrationInstance {
private static final OrchestrationInstance INSTANCE = new OrchestrationInstance();
+ private static final String PORT_KEY = "shardingsphere.port";
+
private String instanceId;
private OrchestrationInstance() {
-
+ String tag = Strings.isNullOrEmpty(System.getProperty(PORT_KEY))
+ ? ManagementFactory.getRuntimeMXBean().getName().split(DELIMITER)[0] : System.getProperty(PORT_KEY);
+ instanceId = IpUtils.getIp() + DELIMITER + tag + DELIMITER + UUID.randomUUID().toString();
}
/**
@@ -45,19 +52,6 @@ public final class OrchestrationInstance {
}
/**
- * This method initialises the instance with the instance id.
- *
- * @param instanceTag instance tag of the instance (port/ip)
- * @return singleton instance
- */
- public static OrchestrationInstance init(final String instanceTag) {
- if (null == INSTANCE.instanceId) {
- INSTANCE.instanceId = IpUtils.getIp() + DELIMITER + instanceTag + DELIMITER + UUID.randomUUID().toString();
- }
- return INSTANCE;
- }
-
- /**
* Get instance.
*
* @return singleton instance
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/RegistryCenterTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/RegistryCenterTest.java
index 2f4425c..3af9a58 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/RegistryCenterTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/RegistryCenterTest.java
@@ -42,7 +42,7 @@ public final class RegistryCenterTest {
@Before
public void setUp() throws ReflectiveOperationException {
- registryCenter = new RegistryCenter("test", "3307", registryCenterRepository);
+ registryCenter = new RegistryCenter("test", registryCenterRepository);
Field field = registryCenter.getClass().getDeclaredField("repository");
field.setAccessible(true);
field.set(registryCenter, registryCenterRepository);
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/listener/InstanceStateChangedListenerTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/l [...]
index 4331cfa..e30a3a7 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/listener/InstanceStateChangedListenerTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/listener/InstanceStateChangedListenerTest.java
@@ -21,7 +21,6 @@ import org.apache.shardingsphere.orchestration.center.RegistryCenterRepository;
import org.apache.shardingsphere.orchestration.center.listener.DataChangedEvent;
import org.apache.shardingsphere.orchestration.center.listener.DataChangedEvent.ChangedType;
import org.apache.shardingsphere.orchestration.core.registrycenter.RegistryCenterNodeStatus;
-import org.apache.shardingsphere.orchestration.core.registrycenter.instance.OrchestrationInstance;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -41,7 +40,6 @@ public final class InstanceStateChangedListenerTest {
@Before
public void setUp() {
- OrchestrationInstance.init("3307");
instanceStateChangedListener = new InstanceStateChangedListener("test", registryCenterRepository);
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/listener/RegistryListenerManagerTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/listen [...]
index 299ccd4..eee3e04 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/listener/RegistryListenerManagerTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/test/java/org/apache/shardingsphere/orchestration/core/registrycenter/listener/RegistryListenerManagerTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.orchestration.core.registrycenter.listener;
import org.apache.shardingsphere.orchestration.center.RegistryCenterRepository;
import org.apache.shardingsphere.orchestration.center.listener.DataChangedEvent.ChangedType;
-import org.apache.shardingsphere.orchestration.core.registrycenter.instance.OrchestrationInstance;
import org.apache.shardingsphere.orchestration.core.registrycenter.util.FieldUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -42,7 +41,6 @@ public final class RegistryListenerManagerTest {
@Test
public void assertInitListeners() {
- OrchestrationInstance.init("3307");
RegistryListenerManager actual = new RegistryListenerManager("test", registryCenterRepository);
FieldUtil.setField(actual, "instanceStateChangedListener", instanceStateChangedListener);
FieldUtil.setField(actual, "dataSourceStateChangedListener", dataSourceStateChangedListener);
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/datasource/OrchestrationShardingSphereDataSource.java b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/datasource/OrchestrationShardingSphereDataSource.java
index 2d9953e..de6d024 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/datasource/OrchestrationShardingSphereDataSource.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/datasource/OrchestrationShardingSphereDataSource.java
@@ -53,7 +53,6 @@ import org.apache.shardingsphere.orchestration.core.registrycenter.event.Circuit
import org.apache.shardingsphere.orchestration.core.registrycenter.event.DisabledStateChangedEvent;
import org.apache.shardingsphere.orchestration.core.registrycenter.schema.OrchestrationSchema;
-import java.lang.management.ManagementFactory;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;
@@ -67,15 +66,11 @@ import java.util.Map;
*/
@Getter(AccessLevel.PROTECTED)
public class OrchestrationShardingSphereDataSource extends AbstractOrchestrationDataSource {
-
- private static final String DELIMITER = "@";
-
- private static final String THREAD_ID = ManagementFactory.getRuntimeMXBean().getName().split(DELIMITER)[0];
private ShardingSphereDataSource dataSource;
public OrchestrationShardingSphereDataSource(final OrchestrationConfiguration orchestrationConfig) throws SQLException {
- super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME), THREAD_ID));
+ super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME)));
ConfigCenter configService = getShardingOrchestrationFacade().getConfigCenter();
Collection<RuleConfiguration> configurations = configService.loadRuleConfigurations(DefaultSchema.LOGIC_NAME);
Preconditions.checkState(!configurations.isEmpty(), "Missing the sharding rule configuration on registry center");
@@ -88,7 +83,7 @@ public class OrchestrationShardingSphereDataSource extends AbstractOrchestration
}
public OrchestrationShardingSphereDataSource(final ShardingSphereDataSource shardingSphereDataSource, final OrchestrationConfiguration orchestrationConfig) {
- super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME), THREAD_ID));
+ super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME)));
dataSource = shardingSphereDataSource;
initShardingOrchestrationFacade(Collections.singletonMap(DefaultSchema.LOGIC_NAME, DataSourceConverter.getDataSourceConfigurationMap(dataSource.getDataSourceMap())),
getRuleConfigurationMap(), dataSource.getSchemaContexts().getProps().getProps());
@@ -98,7 +93,7 @@ public class OrchestrationShardingSphereDataSource extends AbstractOrchestration
}
public OrchestrationShardingSphereDataSource(final OrchestrationConfiguration orchestrationConfig, final ClusterConfiguration clusterConfiguration) throws SQLException {
- super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME), THREAD_ID));
+ super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME)));
ConfigCenter configService = getShardingOrchestrationFacade().getConfigCenter();
Collection<RuleConfiguration> configurations = configService.loadRuleConfigurations(DefaultSchema.LOGIC_NAME);
Preconditions.checkState(!configurations.isEmpty(), "Missing the sharding rule configuration on registry center");
@@ -112,7 +107,7 @@ public class OrchestrationShardingSphereDataSource extends AbstractOrchestration
public OrchestrationShardingSphereDataSource(final ShardingSphereDataSource shardingSphereDataSource,
final OrchestrationConfiguration orchestrationConfig, final ClusterConfiguration clusterConfiguration) {
- super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME), THREAD_ID));
+ super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME)));
dataSource = shardingSphereDataSource;
initShardingOrchestrationFacade(Collections.singletonMap(DefaultSchema.LOGIC_NAME, DataSourceConverter.getDataSourceConfigurationMap(dataSource.getDataSourceMap())),
getRuleConfigurationMap(), dataSource.getSchemaContexts().getProps().getProps(), clusterConfiguration);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
index 92e77b7..898cb3c 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
@@ -75,6 +75,8 @@ public final class Bootstrap {
private static final String DEFAULT_CONFIG_PATH = "/conf/";
+ private static final String PORT_KEY = "shardingsphere.port";
+
/**
* Main entrance.
*
@@ -83,11 +85,12 @@ public final class Bootstrap {
*/
public static void main(final String[] args) throws Exception {
int port = getPort(args);
+ System.setProperty(PORT_KEY, String.valueOf(port));
ShardingConfiguration shardingConfig = new ShardingConfigurationLoader().load(getConfigPath(args));
logRuleConfigurationMap(getRuleConfigurations(shardingConfig.getRuleConfigurationMap()).values());
boolean isOrchestration = null != shardingConfig.getServerConfiguration().getOrchestration();
try (ProxyConfigurationConverter converter = ProxyConfigurationConverterFactory.newInstances(isOrchestration)) {
- ProxyConfiguration proxyConfiguration = converter.convert(shardingConfig, String.valueOf(port));
+ ProxyConfiguration proxyConfiguration = converter.convert(shardingConfig);
initialize(proxyConfiguration, port, converter);
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/converter/DefaultConfigurationConverter.java b/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/converter/DefaultConfigurationConverter.java
index ac30de8..085659b 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/converter/DefaultConfigurationConverter.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/converter/DefaultConfigurationConverter.java
@@ -39,7 +39,7 @@ import org.apache.shardingsphere.proxy.config.ShardingConfiguration;
public final class DefaultConfigurationConverter extends AbstractConfigurationConverter {
@Override
- public ProxyConfiguration convert(final ShardingConfiguration shardingConfiguration, final String instanceTag) {
+ public ProxyConfiguration convert(final ShardingConfiguration shardingConfiguration) {
ProxyConfiguration proxyConfiguration = new ProxyConfiguration();
Authentication authentication = new AuthenticationYamlSwapper().swapToObject(shardingConfiguration.getServerConfiguration().getAuthentication());
Map<String, Map<String, DataSourceParameter>> schemaDataSources = getDataSourceParametersMap(shardingConfiguration.getRuleConfigurationMap());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/converter/ProxyConfigurationConverter.java b/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/converter/ProxyConfigurationConverter.java
index 2b658e7..65327cb 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/converter/ProxyConfigurationConverter.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/converter/ProxyConfigurationConverter.java
@@ -32,10 +32,9 @@ public interface ProxyConfigurationConverter extends AutoCloseable {
* Convert proxy configuration.
*
* @param shardingConfiguration sharding configuration
- * @param instanceTag instance tag
* @return proxy configuration
*/
- ProxyConfiguration convert(ShardingConfiguration shardingConfiguration, String instanceTag);
+ ProxyConfiguration convert(ShardingConfiguration shardingConfiguration);
/**
* Build contexts aware.
diff --git a/shardingsphere-proxy/shardingsphere-proxy-orchestration/src/main/java/org/apache/shardingsphere/proxy/orchestration/OrchestrationConfigurationConverter.java b/shardingsphere-proxy/shardingsphere-proxy-orchestration/src/main/java/org/apache/shardingsphere/proxy/orchestration/OrchestrationConfigurationConverter.java
index bb5d935..086fc27 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-orchestration/src/main/java/org/apache/shardingsphere/proxy/orchestration/OrchestrationConfigurationConverter.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-orchestration/src/main/java/org/apache/shardingsphere/proxy/orchestration/OrchestrationConfigurationConverter.java
@@ -55,12 +55,12 @@ public class OrchestrationConfigurationConverter extends AbstractConfigurationCo
private ShardingOrchestrationFacade shardingOrchestrationFacade;
@Override
- public ProxyConfiguration convert(final ShardingConfiguration shardingConfiguration, final String instanceTag) {
+ public ProxyConfiguration convert(final ShardingConfiguration shardingConfiguration) {
Map<String, YamlCenterRepositoryConfiguration> orchestration = shardingConfiguration.getServerConfiguration().getOrchestration();
Set<String> schemaNames = shardingConfiguration.getRuleConfigurationMap().keySet();
ProxyConfiguration proxyConfiguration = new ProxyConfiguration();
shardingOrchestrationFacade = new ShardingOrchestrationFacade(
- new OrchestrationConfigurationYamlSwapper().swapToObject(new YamlOrchestrationConfiguration(orchestration)), schemaNames, instanceTag
+ new OrchestrationConfigurationYamlSwapper().swapToObject(new YamlOrchestrationConfiguration(orchestration)), schemaNames
);
initShardingOrchestrationFacade(shardingConfiguration.getServerConfiguration(), shardingConfiguration.getRuleConfigurationMap(), shardingOrchestrationFacade);
Authentication authentication = shardingOrchestrationFacade.getConfigCenter().loadAuthentication();