txm119161336 commented on issue #2490:
URL: 
https://github.com/apache/shardingsphere-elasticjob/issues/2490#issuecomment-4850258816

   > which are very different semantics
   
   Thank you so much for your reply, my current confusion is every time the 
misfire  is being triggered, it will call normal execute method ,in execute 
method , it will call executeJobInternal(this is the first time) and it will 
call the misfire . I have made comments in below codes. It seems the misfire 
process will be executed two times. Could you help me to explain why the design 
is like this ,or it is a bug?
   ```
   public final void execute(final JobExecutionContext context) throws 
JobExecutionException {
   log.debug("Elastic job: job execute begin, job execution context:{}.", 
context);
   configService.checkMaxTimeDiffSecondsTolerable();
   shardingService.shardingIfNecessary();
   JobExecutionMultipleShardingContext shardingContext = 
executionContextService.getJobExecutionShardingContext();
   
    if 
(executionService.misfireIfNecessary(shardingContext.getShardingItems())) {
        log.info("Elastic job: previous job is still running, new job will 
start after previous job completed. Misfired job had recorded.");
        return;
    }
    executionService.cleanPreviousExecutionInfo();
    executeJobInternal(shardingContext); // first time execution
    log.debug("Elastic job: execute normal completed, sharding context:{}.", 
shardingContext);
    
    while (configService.isMisfire() && 
!executionService.getMisfiredJobItems(shardingContext.getShardingItems()).isEmpty()
 && !stoped && !shardingService.isNeedSharding()) {
        log.debug("Elastic job: execute misfired job, sharding context:{}.", 
shardingContext);
        executionService.clearMisfire(shardingContext.getShardingItems());
        executeJobInternal(shardingContext); // second time execution
        log.debug("Elastic job: misfired job completed, sharding context:{}.", 
shardingContext);
    }
    if (configService.isFailover() && !stoped) {
        failoverService.failoverIfNecessary();
    }
    log.debug("Elastic job: execute all completed, job execution context:{}.", 
context);
   }
   ```


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to