JobOperator#stop can not stop JobExecution correctly in some cases #4064
Labels
for: backport-to-4.3.x
Issues that will be back-ported to the 4.3.x line
has: minimal-example
Bug reports that provide a minimal complete reproducible example
in: core
type: bug
Milestone
Bug description
JobOperator#stop
can not stop JobExecution correctly in the case that the stop command is executed after step finish but before job finish. JobExecute will ends up with statusSTOPPING
instead ofSTOPPED
.Since
STOPPING
is a running state, so I think this stop command does not stop JobExecution correctly.Steps to reproduce
ItemStream
being set usingAbstractTaskletStepBuilder#stream
. TheItemStream
should overrideclose
method.JobOperator#stop
. Make sure this method execute after step finish but before job finish. (You can refer to the method in below example to do this)Expected behavior
JobExecution ends up with status
STOPPED
.Actual behavior
JobExecution ends up with status
STOPPING
.Minimal Complete Reproducible example
This following example can be run under
src/test/java/org/springframework/batch/test
in spring-batch-test module.Or refer to this link to see the source code.
Run this test should generate following output.
The text was updated successfully, but these errors were encountered: