|
|
@ -62,19 +62,23 @@ public class LogicITaskInstanceDispatchOperationFunction |
|
|
|
LogUtils.setTaskInstanceLogFullPathMDC(taskExecutionContext.getLogPath()); |
|
|
|
LogUtils.setTaskInstanceLogFullPathMDC(taskExecutionContext.getLogPath()); |
|
|
|
|
|
|
|
|
|
|
|
MasterTaskExecutionContextHolder.putTaskExecutionContext(taskExecutionContext); |
|
|
|
MasterTaskExecutionContextHolder.putTaskExecutionContext(taskExecutionContext); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int delayTime = taskExecutionContext.getDelayTime(); |
|
|
|
|
|
|
|
if (delayTime > 0) { |
|
|
|
// todo: calculate the delay in master dispatcher then we don't need to use a queue to store the task
|
|
|
|
// todo: calculate the delay in master dispatcher then we don't need to use a queue to store the task
|
|
|
|
final long remainTime = |
|
|
|
final long remainTime = |
|
|
|
DateUtils.getRemainTime(DateUtils.timeStampToDate(taskExecutionContext.getFirstSubmitTime()), |
|
|
|
DateUtils.getRemainTime(DateUtils.timeStampToDate(taskExecutionContext.getFirstSubmitTime()), |
|
|
|
TimeUnit.SECONDS.toMillis(taskExecutionContext.getDelayTime())); |
|
|
|
TimeUnit.SECONDS.toMillis(delayTime)); |
|
|
|
if (remainTime > 0) { |
|
|
|
if (remainTime > 0) { |
|
|
|
log.info("Current taskInstance: {} is choosing delay execution, delay time: {}/ms, remainTime: {}/ms", |
|
|
|
log.info( |
|
|
|
|
|
|
|
"Current taskInstance: {} is choosing delay execution, delay time: {}/ms, remainTime: {}/ms", |
|
|
|
taskExecutionContext.getTaskName(), |
|
|
|
taskExecutionContext.getTaskName(), |
|
|
|
TimeUnit.SECONDS.toMillis(taskExecutionContext.getDelayTime()), remainTime); |
|
|
|
TimeUnit.SECONDS.toMillis(taskExecutionContext.getDelayTime()), remainTime); |
|
|
|
taskExecutionContext.setCurrentExecutionStatus(TaskExecutionStatus.DELAY_EXECUTION); |
|
|
|
taskExecutionContext.setCurrentExecutionStatus(TaskExecutionStatus.DELAY_EXECUTION); |
|
|
|
// todo: send delay execution message
|
|
|
|
// todo: send delay execution message
|
|
|
|
return LogicTaskDispatchResponse.success(taskExecutionContext.getTaskInstanceId()); |
|
|
|
return LogicTaskDispatchResponse.success(taskExecutionContext.getTaskInstanceId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
final MasterDelayTaskExecuteRunnable masterDelayTaskExecuteRunnable = |
|
|
|
final MasterDelayTaskExecuteRunnable masterDelayTaskExecuteRunnable = |
|
|
|
masterTaskExecuteRunnableFactoryBuilder |
|
|
|
masterTaskExecuteRunnableFactoryBuilder |
|
|
|
.createWorkerDelayTaskExecuteRunnableFactory(taskExecutionContext.getTaskType()) |
|
|
|
.createWorkerDelayTaskExecuteRunnableFactory(taskExecutionContext.getTaskType()) |
|
|
|