johnny2002 edited a comment on issue #1720:
URL: 
https://github.com/apache/shardingsphere-elasticjob/issues/1720#issuecomment-727569644


   > @johnny2002 Hi, thank you for the suggestion.
   > I want discuss further.
   > Job instance id is internal impl in elastic job which user should not 
focus on them.
   > It is not a good idea to expose lots of internal impl to special reason.
   > 
   > Can you consider about reuse the job sharding strategy to rebalance your 
sub-job?
   
   Hi Terry,
   My problem is cannot identify JobInstnaces. **Update on 2020-11-16: Sorry, I 
found this design not work, please ignore it.**
   ~~If you don't like to change the jobinstance id, I have another graceful 
way like:
   Pass all System Properties that name starts with "elasticjob." into 
JobInstance.
   Sample code:~~
   ```java
   public final class JobInstance {
   
   
       public static final String DELIMITER = "@-@";
   
       private final String jobInstanceId;
       
       private final Map<String, String> properties = new LinkedHashMap<>();
       public JobInstance() {
           jobInstanceId = IpUtils.getIp() + DELIMITER + 
ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
           
           //extract all system properties that name start with "elasticjob."
           for (Map.Entry propEntry : System.getProperties().entrySet()) {
               if (propEntry.getKey().toString().startsWith("elasticjob.")) {
                   properties.put((String)propEntry.getKey(), 
(String)propEntry.getValue());
               }
           }
       }
   ```
   ~~Then we can identify JobInstance through JobInstance.properties~~


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