我有弹簧批处理设置,我正在尝试并行运行两个作业。我有一个工作正常,但在添加第二个工作时,它停止工作。作业设置如下:
<job id="job">
<split id="split_1" task-executor="taskExecutor" next="step_4">
<flow>
<step id="step_1">
<tasklet ref="taskletStep_1"/>
</step>
</flow>
<flow>
<step id="step_2">
<tasklet ref="taskletStep_2"/>
</step>
</flow>
<flow>
<step id="step_3">
<tasklet ref="taskletStep_3"/>
</step>
</flow>
</split>
<step id="step_4">
<tasklet ref="taskletStep_3"/>
</step>
</job>
<job id="job2">
<split id="split_2" task-executor="taskExecutor" next="step_8">
<flow>
<step id="step_5">
<tasklet ref="taskletStep_4"/>
</step>
</flow>
<flow>
<step id="step_6">
<tasklet ref="taskletStep_5"/>
</step>
</flow>
<flow>
<step id="step_7">
<tasklet ref="taskletStep_6"/>
</step>
</flow>
</split>
<step id="step_8">
<tasklet ref="taskletStep_6"/>
</step>
</job>
当它与一个工作一起工作时,它工作正常。当我添加第二个作业时,第一个作业工作正常,但第二个作业呈现:
INFO 40904 --- [nio-8181-exec-1] c.j.b.p.c.JobLauncherController : The Job must not be null.
作业启动器设置如下所示:
@RestController
public class JobLauncherController {
@Autowired
JobLauncher jobLauncher;
@Autowired
Job job;
Job job2;
@RequestMapping("/launchjob")
public String handle() throws Exception {
Logger logger = LoggerFactory.getLogger(this.getClass());
try {
JobParameters jobParameters = new JobParametersBuilder().addLong("time", System.currentTimeMillis())
.toJobParameters();
jobLauncher.run(job, jobParameters);
jobLauncher.run(job2, jobParameters);
} catch (Exception e) {
logger.info(e.getMessage());
}
return "Done";
}
}
有什么建议来解决这个问题吗?不知道我错过了什么。
收到一只叮咚
相关分类