swayamraina commented on a change in pull request #6187:
URL: https://github.com/apache/shardingsphere/pull/6187#discussion_r450786777



##########
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
##########
@@ -29,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 identifier) {
+        instanceId = IpUtils.getIp() + DELIMITER + identifier + DELIMITER + 
UUID.randomUUID().toString();

Review comment:
       @menghaoranss  If we go ahead with this approach, we will risk someone 
calling `getInstance()` without ensuring `init()` was called and then returning 
an empty string as instanceId.
   Moreover, this makes instanceId mutable i.e. anyone can do 
`OrchestrationInstance.getInstance().init("a")` and then 
`OrchestrationInstance.getInstance().init("b")`




----------------------------------------------------------------
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


Reply via email to