menghaoranss commented on a change in pull request #6187: URL: https://github.com/apache/shardingsphere/pull/6187#discussion_r446475914
########## File path: shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/instance/OrchestrationInstance.java ########## @@ -30,21 +28,30 @@ public final class OrchestrationInstance { private static final String DELIMITER = "@"; - - private static final OrchestrationInstance INSTANCE = new OrchestrationInstance(); + + private static OrchestrationInstance instance; private final String instanceId; - - private OrchestrationInstance() { - instanceId = IpUtils.getIp() + DELIMITER + ManagementFactory.getRuntimeMXBean().getName().split(DELIMITER)[0] + DELIMITER + UUID.randomUUID().toString(); + + public OrchestrationInstance(final int port) { + instanceId = IpUtils.getIp() + DELIMITER + port; Review comment: `UUID` should be kept ########## File path: shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/datasource/OrchestrationShardingSphereDataSource.java ########## @@ -69,7 +69,7 @@ private ShardingSphereDataSource dataSource; public OrchestrationShardingSphereDataSource(final OrchestrationConfiguration orchestrationConfig) throws SQLException { - super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME))); + super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME), 3307)); Review comment: `OrchestrationShardingSphereDataSource` is provided for `sharding-jdbc`, can not specify a fixed port , `sharding-jdbc` should still retain threadId as the unique identifier of the instance. ########## File path: shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/datasource/OrchestrationShardingSphereDataSource.java ########## @@ -106,7 +106,7 @@ public OrchestrationShardingSphereDataSource(final OrchestrationConfiguration or public OrchestrationShardingSphereDataSource(final ShardingSphereDataSource shardingSphereDataSource, final OrchestrationConfiguration orchestrationConfig, final ClusterConfiguration clusterConfiguration) { - super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME))); + super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME), 3307)); Review comment: Same as above. ########## File path: shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/datasource/OrchestrationShardingSphereDataSource.java ########## @@ -92,7 +92,7 @@ public OrchestrationShardingSphereDataSource(final ShardingSphereDataSource shar } public OrchestrationShardingSphereDataSource(final OrchestrationConfiguration orchestrationConfig, final ClusterConfiguration clusterConfiguration) throws SQLException { - super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME))); + super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME), 3307)); Review comment: Same as above. ########## File path: shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/datasource/OrchestrationShardingSphereDataSource.java ########## @@ -82,7 +82,7 @@ public OrchestrationShardingSphereDataSource(final OrchestrationConfiguration or } public OrchestrationShardingSphereDataSource(final ShardingSphereDataSource shardingSphereDataSource, final OrchestrationConfiguration orchestrationConfig) { - super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME))); + super(new ShardingOrchestrationFacade(orchestrationConfig, Collections.singletonList(DefaultSchema.LOGIC_NAME), 3307)); Review comment: Same as above. ########## File path: 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 @@ private final ShardingOrchestrationListenerManager listenerManager; - public ShardingOrchestrationFacade(final OrchestrationConfiguration orchestrationConfig, final Collection<String> shardingSchemaNames) { + public ShardingOrchestrationFacade(final OrchestrationConfiguration orchestrationConfig, final Collection<String> shardingSchemaNames, final int port) { Review comment: `ShardingOrchestrationFacade` is provided to both `proxy` and `sharding-jdbc`, may be the variable defined as `port` is not suitable, It should describe a unique identifier of the orchestration instance, for `proxy`, it's a port, and for `sharding-jdbc`, it's a threadId. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org