History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: BATCH-456
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Robert Kasanicky
Reporter: Lucas Ward
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Spring Batch

JobListener.afterJob() should be called regardless of success or failure

Created: 13/Mar/08 02:15 PM   Updated: 14/Mar/08 12:47 PM
Component/s: None
Affects Version/s: 1.0.0.m5
Fix Version/s: 1.0.0.rc1

Time Tracking:
Original Estimate: 0.06d
Original Estimate - 0.06d
Remaining Estimate: 0.06d
Remaining Estimate - 0.06d
Time Spent: Not Specified
Remaining Estimate - 0.06d


 Description  « Hide
The StepListener.afterStep method is called regardless of success or failure, so the JobListener equivalent should be as well. This will also help alleviate a couple of the issues raised on the forums, since people will be able to check the JobExecution to see what happened if they need to.

 All   Comments   Work Log   Change History   FishEye   Related Builds      Sort Order: Ascending order - Click to sort in descending order
Dave Syer - 14/Mar/08 02:43 AM
I'm tempted to just remove the JobListener altogether because there is nothing there that you can't do with AOP. But so many people seem to expect it, that maybe we should just give in and add the onError() callback (so after is like normal after advice and is not executed on error)..

Robert Kasanicky - 14/Mar/08 04:30 AM
So opinions what to do vary - for now I've added JobListener#onError(JobExecution, Throwable) that is called when job failed, but not when it was interrupted. The problem I see with simply always calling afterJob is that it doesn't provide access to the exception in failure case.

Leaving the issue open until consensus is reached.

Dave Syer - 14/Mar/08 12:33 PM
Lucas and I agree this is fine.

Dave Syer - 14/Mar/08 12:47 PM
I added an onInterrupt() callback as well to encapsulate the knowledge of how to detect an interrupt in the Job. THis at least justifies the existence of JobListener interface - you can't do it all with AOP any more.