-
Mar 11th, 2008, 09:23 AM
#1
Problems with JobExecution.isRunning ()
Since 1.0.0.m4, a new test have been added when re-executing a failed batch.
The new test lies in org.springframework.batch.core.domain.JobExecution class.
When you re-start a failed batch, it checks if the jobexecution is running or not.
I've checked that 1.0.0.m3 didn't do this test.
Here is the method:
/**
* Test if this {@link JobExecution} indicates that it is running. It should
* be noted that this does not necessarily mean that it has been persisted
* as such yet.
* @return true if the end time is null
*/
public boolean isRunning() {
return endTime == null;
}
What's the point ?
Considere the following scenario:
- You start you're batch
- It creates a new job instance and job execution
- You simulate a hardware failure by killing the batch while it runs.
=> job execution state is still STARTED with NO END DATE, because the batch haven't had any chance to update DB before it gets killed.
- You restart the same batch.
=> It finds again the same JobInstance and JobExecution, but sees that the JobExecution.isRunning () is true, so it returns an error:
org.springframework.batch.core.repository.JobExecu tionAlreadyRunningException: A job execution for this job is already running
Expected behavior (?)
My point of view is that a killed batch should be restartable without errors.
Should I create a JIRA bug ?
Gérard COLLIN
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules