OPEN - issue BATCH-398: That old stateful / stateless thing again....
http://jira.springframework.org/browse/BATCH-398 Fix delegate job (duplicate job regsitry).
This commit is contained in:
@@ -36,12 +36,17 @@ public class DefaultJobLoader implements JobLoader,
|
||||
|
||||
public Map getConfigurations() {
|
||||
Map result = new HashMap(configurations);
|
||||
for (Iterator iterator = registry.getJobConfigurations().iterator(); iterator
|
||||
for (Iterator iterator = registry.getJobNames().iterator(); iterator
|
||||
.hasNext();) {
|
||||
Job configuration = (Job) iterator.next();
|
||||
String name = configuration.getName();
|
||||
if (!configurations.containsKey(name)) {
|
||||
result.put(name, "<unknown path>: " + configuration);
|
||||
try {
|
||||
Job configuration = (Job) registry.getJob((String) iterator.next());
|
||||
String name = configuration.getName();
|
||||
if (!configurations.containsKey(name)) {
|
||||
result.put(name, "<unknown path>: " + configuration);
|
||||
}
|
||||
}
|
||||
catch (NoSuchJobException e) {
|
||||
throw new IllegalStateException("Registry could not locate its own job (NoSuchJobException).");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.batch.sample;
|
||||
|
||||
import org.springframework.batch.core.repository.JobRegistry;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
@@ -23,11 +24,16 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
*
|
||||
*/
|
||||
public class TaskExecutorLauncher {
|
||||
|
||||
private JobRegistry registry;
|
||||
|
||||
private void register(String[] paths) {
|
||||
// registry.register(jobConfiguration)
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
// Paths to individual job configurations. Each one must include the
|
||||
// step scope and the jobConfigurationRegistryBeanPostProcessor.
|
||||
// Paths to individual job configurations.
|
||||
final String[] paths = new String[] { "jobs/adhocLoopJob.xml",
|
||||
"jobs/footballJob.xml" };
|
||||
|
||||
@@ -39,6 +45,8 @@ public class TaskExecutorLauncher {
|
||||
// included in the paths above.
|
||||
final ApplicationContext parent = new ClassPathXmlApplicationContext(
|
||||
"adhoc-job-launcher-context.xml");
|
||||
// parent.getAutowireCapableBeanFactory().autowireBeanProperties(
|
||||
// this, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);
|
||||
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user