spring作业启动程序(job2)在spring升级到5.3.2.release后将job1退出代码更改为未知

mu0hgdu0  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(177)

我有两个作业(samplejob,newjob)newjob依赖于samplejob的输出,因此newjob必须等到samplejob完成。我已经写了这样的代码来实现这一点。直到spring版本4.3.22.release,它仍然工作正常。现在,在作业启动步骤之后,它没有触发endstep,因为我的作业在作业侦听器的after步骤中处于未知状态

<batch:job id="SAMPLE_JOB" job-repository="jobRepository">

        <batch:step id="startStep" next="processStep">
            <batch:tasklet ref="timerBegin" />
        </batch:step>

        <batch:step id="processStep" next="sampleJobLauncher">
            <batch:tasklet ref="dataProcessTasklet" />
        </batch:step>

        <batch:step id="sampleJobLauncher" next="endBaselElRatioStep">
              <job ref="NEW_JOB" job-launcher="jobLauncher" job-parameters-extractor="jobParametersExtractor"/>          
        </batch:step>       

        <batch:step id="endStep" >  
            <batch:tasklet ref="timerEnd" />
        </batch:step>

        <batch:listeners>
            <batch:listener ref="SampleJobListener" />
        </batch:listeners>      
    </batch:job>

在最新的spring版本中,jobstep.java的代码导致了这个问题,它将job1退出代码重写为未知

private ExitStatus determineStepExitStatus(StepExecution stepExecution, JobExecution jobExecution) {
        ExitStatus exitStatus = stepExecution.getExitStatus() != null ? stepExecution.getExitStatus() : ExitStatus.COMPLETED;

        return exitStatus.and(jobExecution.getExitStatus());
    }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题