|
|
@ -114,30 +114,29 @@ public class MasterBaseTaskExecThread implements Callable<Boolean> { |
|
|
|
Integer commitRetryInterval = masterConfig.getMasterTaskCommitInterval(); |
|
|
|
Integer commitRetryInterval = masterConfig.getMasterTaskCommitInterval(); |
|
|
|
|
|
|
|
|
|
|
|
int retryTimes = 1; |
|
|
|
int retryTimes = 1; |
|
|
|
boolean taskDBFlag = false; |
|
|
|
boolean submitDB = false; |
|
|
|
boolean taskQueueFlag = false; |
|
|
|
boolean submitQueue = false; |
|
|
|
TaskInstance task = null; |
|
|
|
TaskInstance task = null; |
|
|
|
while (true){ |
|
|
|
while (retryTimes <= commitRetryTimes){ |
|
|
|
try { |
|
|
|
try { |
|
|
|
if(!taskDBFlag){ |
|
|
|
if(!submitDB){ |
|
|
|
// submit task to db
|
|
|
|
// submit task to db
|
|
|
|
task = processDao.submitTask(taskInstance, processInstance); |
|
|
|
task = processDao.submitTask(taskInstance, processInstance); |
|
|
|
if(task != null && task.getId() != 0){ |
|
|
|
if(task != null && task.getId() != 0){ |
|
|
|
taskDBFlag = true; |
|
|
|
submitDB = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(taskDBFlag && !taskQueueFlag){ |
|
|
|
if(submitDB && !submitQueue){ |
|
|
|
// submit task to queue
|
|
|
|
// submit task to queue
|
|
|
|
taskQueueFlag = processDao.submitTaskToQueue(task); |
|
|
|
submitQueue = processDao.submitTaskToQueue(task); |
|
|
|
} |
|
|
|
} |
|
|
|
if(taskDBFlag && taskQueueFlag){ |
|
|
|
if(submitDB && submitQueue){ |
|
|
|
return task; |
|
|
|
return task; |
|
|
|
} |
|
|
|
} |
|
|
|
if(!taskDBFlag){ |
|
|
|
if(!submitDB){ |
|
|
|
logger.error("task commit to db failed , task has already retry {} times, please check the database", retryTimes); |
|
|
|
logger.error("task commit to db failed , taskId {} has already retry {} times, please check the database", taskInstance.getId(), retryTimes); |
|
|
|
}else if(!taskQueueFlag){ |
|
|
|
}else if(!submitQueue){ |
|
|
|
logger.error("task commit to queue failed , task has already retry {} times, please check the database", retryTimes); |
|
|
|
logger.error("task commit to queue failed , taskId {} has already retry {} times, please check the queue", taskInstance.getId(), retryTimes); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
Thread.sleep(commitRetryInterval); |
|
|
|
Thread.sleep(commitRetryInterval); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
@ -145,6 +144,7 @@ public class MasterBaseTaskExecThread implements Callable<Boolean> { |
|
|
|
} |
|
|
|
} |
|
|
|
retryTimes += 1; |
|
|
|
retryTimes += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return task; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|