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:
dsyer
2008-03-01 08:35:12 +00:00
parent 6f6ea2d70e
commit f2129d4ea7
9 changed files with 66 additions and 30 deletions

View File

@@ -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;

View File

@@ -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() {