johnny2002 opened a new issue #1720:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1720


   ## Feature Request
   
   For some reason, we need to customize the JobInstance ID, so that we can 
assign specific shard number to specific JobInstance.
   
   And as I found in JobInstance.java, the JobInstance ID is fixed to IP 
concate with JVM name. The code as following:
   
   ```java
       public JobInstance() {
           jobInstanceId = IpUtils.getIp() + DELIMITER + 
ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
       }
   
   ```
   
   ### Is your feature request related to a problem?
   
   ### Describe the feature you would like.
   Suggest to check whether a "jobInstanceId" property is exists, if so, use IP 
concat with this property instead of jvm name.
   code like this:
   ```java
       public JobInstance() {
           String jobInstIdSuffix = System.getProperty("jobInstanceId");
           if (jobInstIdSuffix == null) {
                jobInstIdSuffix = 
ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
           }
                jobInstanceId = IpUtils.getIp() + DELIMITER + jobInstIdSuffix;
       }
   ```
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to