OPEN - issue BATCH-378: RepeatListener is confusing and too generic to use for 'intercepting' a step
http://jira.springframework.org/browse/BATCH-378 No need for setListener() methods.
This commit is contained in:
@@ -57,10 +57,6 @@ public class SimpleJob extends AbstractJob {
|
||||
}
|
||||
}
|
||||
|
||||
public void setListener(JobListener listener) {
|
||||
this.listener.register(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the specified job by looping through the steps and delegating to the
|
||||
* {@link Step}.
|
||||
|
||||
@@ -116,15 +116,6 @@ public class ItemOrientedStep extends AbstractStep implements InitializingBean {
|
||||
listener.register(listeners[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the objects as a listener.
|
||||
* @see #setListeners(Object[])
|
||||
* @param listener the listener to set
|
||||
*/
|
||||
public void setListener(Object listener) {
|
||||
this.listener.register(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link RepeatOperations} to use for the outer loop of the batch
|
||||
|
||||
@@ -141,14 +141,14 @@ public class SimpleJobTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testRunNormallyWithListener() throws Exception {
|
||||
job.setListener(new JobListenerSupport() {
|
||||
job.setListeners(new JobListenerSupport[] {new JobListenerSupport() {
|
||||
public void beforeJob(JobExecution jobExecution) {
|
||||
list.add("before");
|
||||
}
|
||||
public void afterJob() {
|
||||
list.add("after");
|
||||
}
|
||||
});
|
||||
}});
|
||||
job.execute(jobExecution);
|
||||
assertEquals(4, list.size());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user