I have the below model.
One (master)partitionstep, and it contains slave TaskletStep(s), within which I call my business process.
If the business process successfully completes, I mark the envelope TaskletStep to be COMPLETED. Otherwise if the business process throws some exception, TaskletStep is FAILED.
One slave tasklet step is totally independent of the other. So one tasklet step may have a FAILED status, while its sibling may have a COMPLETED status.
And as usual partition step will have a status based on the aggregation of the slave steps.
Now, I want to implement the stop functionality.
So I tried JobOperator:stop().
1) Inside TaskletStep:doExecute(), once the call to tasklet.execute() returned, there is a call getJobRepository().update(stepExecution).
Inside getJobRepository().update(), if the jobExecution is STOPPING, the stepExuection is set as terminateOnly.
Is this correct? Because, we have already completed the actual work within the tasklet.execute() itself. Now what is the point in making the step execution as terminateOnly and marking it as STOPPED.
Additionally, if we restart the job, this step execution will again get picked up, even if we had already completed the actual work previous time itself.
2) Again inside TaskletStep:doExecute(), there is a call to interruptionPolicy.checkInterrupted(...). Is this really needed, since we have already done the real work?
Now even if we want to call the checkInterrupted(), shouldn't we be checking the current status of stepexecution before throwing a JobInterruptedException.
Comments?
Thanks in Advance!


Reply With Quote
