swayamraina commented on a change in pull request #6187: URL: https://github.com/apache/shardingsphere/pull/6187#discussion_r449677660
########## 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 i am thinking of keeping the impl like this, ``` public static OrchestrationInstance init(final String instanceTag) { if (null == instance) { synchronized (OrchestrationInstance.class) { if (null == instance) { instance = new OrchestrationInstance(instanceTag); } } } return instance; } public static String getInstanceId() { if (null == instance) { throw new IllegalStateException("OrchestrationInstance not initialized!"); } return instance.instanceId; } ``` but because of this code `InstanceStateChangedListenerTest.setUp()` throws the `IllegalStateException`. Will need to refactor the test-case as well. Should this be ok? ---------------------------------------------------------------- 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