RESOLVED - issue BATCH-419: JobListener and StepListener should pass in JobExecution/StepExecution in each method
http://jira.springframework.org/browse/BATCH-419 added JobExecution argument to JobListener#afterJob
This commit is contained in:
@@ -36,5 +36,5 @@ public interface JobListener {
|
||||
/**
|
||||
* Callback after successful completion of a job.
|
||||
*/
|
||||
void afterJob();
|
||||
void afterJob(JobExecution jobExecution);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class JobListenerSupport implements JobListener {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.JobListener#afterJob()
|
||||
*/
|
||||
public void afterJob() {
|
||||
public void afterJob(JobExecution jobExecution) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -110,7 +110,7 @@ public class SimpleJob extends AbstractJob {
|
||||
|
||||
updateStatus(execution, BatchStatus.COMPLETED);
|
||||
|
||||
listener.afterJob();
|
||||
listener.afterJob(execution);
|
||||
|
||||
}
|
||||
catch (JobInterruptedException e) {
|
||||
|
||||
@@ -54,10 +54,10 @@ public class CompositeJobListener implements JobListener {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.StepListener#close()
|
||||
*/
|
||||
public void afterJob() {
|
||||
public void afterJob(JobExecution jobExecution) {
|
||||
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
JobListener listener = (JobListener) iterator.next();
|
||||
listener.afterJob();
|
||||
listener.afterJob(jobExecution);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ public class SimpleJobTests extends TestCase {
|
||||
public void beforeJob(JobExecution jobExecution) {
|
||||
list.add("before");
|
||||
}
|
||||
public void afterJob() {
|
||||
public void afterJob(JobExecution jobExecution) {
|
||||
list.add("after");
|
||||
}
|
||||
}});
|
||||
|
||||
@@ -43,15 +43,15 @@ public class CompositeJobListenerTests extends TestCase {
|
||||
*/
|
||||
public void testSetListeners() {
|
||||
listener.setListeners(new JobListener[] { new JobListenerSupport() {
|
||||
public void afterJob() {
|
||||
public void afterJob(JobExecution jobExecution) {
|
||||
list.add("fail");
|
||||
}
|
||||
}, new JobListenerSupport() {
|
||||
public void afterJob() {
|
||||
public void afterJob(JobExecution jobExecution) {
|
||||
list.add("continue");
|
||||
}
|
||||
} });
|
||||
listener.afterJob();
|
||||
listener.afterJob(null);
|
||||
assertEquals(2, list.size());
|
||||
}
|
||||
|
||||
@@ -61,11 +61,11 @@ public class CompositeJobListenerTests extends TestCase {
|
||||
*/
|
||||
public void testSetListener() {
|
||||
listener.register(new JobListenerSupport() {
|
||||
public void afterJob() {
|
||||
public void afterJob(JobExecution jobExecution) {
|
||||
list.add("fail");
|
||||
}
|
||||
});
|
||||
listener.afterJob();
|
||||
listener.afterJob(null);
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user