|
@@ -7,7 +7,6 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import cn.com.qmth.task.base.QuartzManager;
|
|
|
import cn.com.qmth.task.base.ScheduleJob;
|
|
|
-import cn.com.qmth.task.base.enums.JobStatus;
|
|
|
import cn.com.qmth.task.entity.ScheduleJobEntity;
|
|
|
import cn.com.qmth.task.service.ScheduleJobEntityService;
|
|
|
|
|
@@ -24,17 +23,10 @@ public class JobsInitialization implements Runnable{
|
|
|
public void run() {
|
|
|
List<ScheduleJobEntity> scheduleJobEntitys = scheduleJobEntityService.findAll();
|
|
|
for(ScheduleJobEntity scheduleJobEntity:scheduleJobEntitys){
|
|
|
- try{
|
|
|
- ScheduleJob scheduleJob = scheduleJobEntityService.transformationToScheduleJob(scheduleJobEntity);
|
|
|
- quartzManager.addJob(scheduleJob);
|
|
|
- scheduleJobEntity.setJobStatus(JobStatus.RUNNING.name());
|
|
|
- scheduleJobEntity.setOperateResult(JobStatus.RUNNING.name()+" SUCCESS");
|
|
|
- scheduleJobEntityService.saveScheduleJobEntity(scheduleJobEntity);
|
|
|
- }catch(Exception e){
|
|
|
-
|
|
|
- scheduleJobEntity.setOperateResult(JobStatus.RUNNING.name()+" FAILED");
|
|
|
- scheduleJobEntityService.saveScheduleJobEntity(scheduleJobEntity);
|
|
|
- }
|
|
|
+ ScheduleJob scheduleJob = scheduleJobEntityService.transformationToScheduleJob(scheduleJobEntity);
|
|
|
+ if(scheduleJob.isStartWithContainer()){
|
|
|
+ quartzManager.addJob(scheduleJob);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|