You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/11/13 08:01:33 UTC

[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a change in pull request #1721: #1720 Let user can customize the jobInstanceId

TeslaCN commented on a change in pull request #1721:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1721#discussion_r522761700



##########
File path: elasticjob-infra/elasticjob-infra-common/src/main/java/org/apache/shardingsphere/elasticjob/infra/handler/sharding/JobInstance.java
##########
@@ -34,10 +34,16 @@
     
     private static final String DELIMITER = "@-@";
     
+    private static final String PARAM_JOB_INST_ID = "jobInstanceId";

Review comment:
       Name it `PROPERTY_JOB_INSTANCE_ID` may be better.

##########
File path: elasticjob-infra/elasticjob-infra-common/src/main/java/org/apache/shardingsphere/elasticjob/infra/handler/sharding/JobInstance.java
##########
@@ -34,10 +34,16 @@
     
     private static final String DELIMITER = "@-@";
     
+    private static final String PARAM_JOB_INST_ID = "jobInstanceId";
+
     private final String jobInstanceId;
     
     public JobInstance() {
-        jobInstanceId = IpUtils.getIp() + DELIMITER + ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
+        String jobInstIdSuffix = System.getProperty(PARAM_JOB_INST_ID);
+        if (jobInstIdSuffix == null) {

Review comment:
       Constant is on the left.




----------------------------------------------------------------
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:
users@infra.apache.org