Oct 17th, 2008, 10:52 AM
Bit Confused on Stopping Jobs
Sorry there, i've read the documentation, evne a few times course that doesnt mean i still don't have it correct.
BUT my question is on stopping and restarting a job.
So if i have a job, i want to start and restop. I first assume i have to set restartable to true.
Now let's say i have 3 steps. In the middle of step two i grab the JobExecution and tell it to stop the job.
Now i want to restart the job.
Is the job going to restart from step 1. Or is it going to restart where it left off? And if it restarts where it left off how does it know where to restart? I am assuming somehow through the mark and reset?
if there isnt a way to identify would it be that hard to make it so that there is a way?
Oct 20th, 2008, 11:58 AM
I think there's two parts to your question:
The first is about what happens to steps that have already been completed in a restart scenario. If you have three steps, and the first two complete, and the third fails midway through, the first two will be skipped, and the third will be started.
The next part of your question I think deals with what happens with that third step. Every StepExecution is given an ExecutionContext(EC), in which to store any properties regarding it's current state. When a step is restarted, the EC is reconstituted from the database and given to the step. Most of the readers and writers that come with the framework will check the EC when the Step calls open, to see if any values they care about are stored there. In the case of FlatFileItemReader, it will be checking for the last line number it was processing. If it finds it, it will move to the line and start reading from there.