committed by
Fadhel Mahmoud Ben Hassine
parent
d280556d02
commit
c0791039dc
@@ -22,7 +22,7 @@ import org.springframework.batch.core.configuration.BatchConfigurationException;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.explore.support.JobExplorerFactoryBean;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.batch.core.launch.support.SimpleJobLauncher;
|
||||
import org.springframework.batch.core.launch.support.TaskExecutorJobLauncher;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
@@ -133,7 +133,7 @@ public class DefaultBatchConfigurer implements BatchConfigurer, InitializingBean
|
||||
* creating the {@link JobLauncher}.
|
||||
*/
|
||||
protected JobLauncher createJobLauncher() throws Exception {
|
||||
SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
|
||||
TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher();
|
||||
jobLauncher.setJobRepository(this.jobRepository);
|
||||
jobLauncher.afterPropertiesSet();
|
||||
return jobLauncher;
|
||||
|
||||
@@ -26,10 +26,9 @@ import org.springframework.batch.core.configuration.JobRegistry;
|
||||
import org.springframework.batch.core.configuration.support.ApplicationContextFactory;
|
||||
import org.springframework.batch.core.configuration.support.AutomaticJobRegistrar;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.batch.core.launch.support.TaskExecutorJobLauncher;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.beans.factory.UnsatisfiedDependencyException;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -102,7 +101,7 @@ import org.springframework.transaction.PlatformTransactionManager;
|
||||
* <li>a {@link JobRepository} (bean name "jobRepository" of type
|
||||
* {@link org.springframework.batch.core.repository.support.SimpleJobRepository})</li>
|
||||
* <li>a {@link JobLauncher} (bean name "jobLauncher" of type
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleJobLauncher})</li>
|
||||
* {@link TaskExecutorJobLauncher})</li>
|
||||
* <li>a {@link JobRegistry} (bean name "jobRegistry" of type
|
||||
* {@link org.springframework.batch.core.configuration.support.MapJobRegistry})</li>
|
||||
* <li>a {@link org.springframework.batch.core.explore.JobExplorer} (bean name
|
||||
@@ -190,7 +189,7 @@ import org.springframework.transaction.PlatformTransactionManager;
|
||||
* </job>
|
||||
* <beans:bean id="transactionManager" .../>
|
||||
* <beans:bean id="jobLauncher" class=
|
||||
"org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
"org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
* <beans:property name="jobRepository" ref="jobRepository" />
|
||||
* </beans:bean>
|
||||
* </batch>
|
||||
|
||||
@@ -62,9 +62,9 @@ import org.springframework.util.Assert;
|
||||
* @see JobRepository
|
||||
* @see TaskExecutor
|
||||
*/
|
||||
public class SimpleJobLauncher implements JobLauncher, InitializingBean {
|
||||
public class TaskExecutorJobLauncher implements JobLauncher, InitializingBean {
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(SimpleJobLauncher.class);
|
||||
protected static final Log logger = LogFactory.getLog(TaskExecutorJobLauncher.class);
|
||||
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.batch.core.step.builder;
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.batch.core.launch.support.SimpleJobLauncher;
|
||||
import org.springframework.batch.core.launch.support.TaskExecutorJobLauncher;
|
||||
import org.springframework.batch.core.step.job.JobParametersExtractor;
|
||||
import org.springframework.batch.core.step.job.JobStep;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class JobStepBuilder extends StepBuilderHelper<JobStepBuilder> {
|
||||
step.setJobParametersExtractor(jobParametersExtractor);
|
||||
}
|
||||
if (jobLauncher == null) {
|
||||
SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
|
||||
TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher();
|
||||
jobLauncher.setJobRepository(getJobRepository());
|
||||
try {
|
||||
jobLauncher.afterPropertiesSet();
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.springframework.batch.core.JobParametersValidator;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.job.DefaultJobParametersValidator;
|
||||
import org.springframework.batch.core.job.JobSupport;
|
||||
import org.springframework.batch.core.launch.support.SimpleJobLauncher;
|
||||
import org.springframework.batch.core.launch.support.TaskExecutorJobLauncher;
|
||||
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.JobRestartException;
|
||||
@@ -52,9 +52,9 @@ import org.springframework.core.task.TaskRejectedException;
|
||||
* @author Will Schipp
|
||||
*
|
||||
*/
|
||||
public class SimpleJobLauncherTests {
|
||||
public class TaskExecutorJobLauncherTests {
|
||||
|
||||
private SimpleJobLauncher jobLauncher;
|
||||
private TaskExecutorJobLauncher jobLauncher;
|
||||
|
||||
private JobSupport job = new JobSupport("foo") {
|
||||
@Override
|
||||
@@ -71,7 +71,7 @@ public class SimpleJobLauncherTests {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
jobLauncher = new SimpleJobLauncher();
|
||||
jobLauncher = new TaskExecutorJobLauncher();
|
||||
jobRepository = mock(JobRepository.class);
|
||||
jobLauncher.setJobRepository(jobRepository);
|
||||
|
||||
@@ -233,7 +233,7 @@ public class SimpleJobLauncherTests {
|
||||
@Test
|
||||
public void testInitialiseWithoutRepository() throws Exception {
|
||||
try {
|
||||
new SimpleJobLauncher().afterPropertiesSet();
|
||||
new TaskExecutorJobLauncher().afterPropertiesSet();
|
||||
fail("Expected IllegalArgumentException");
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
@@ -245,7 +245,7 @@ public class SimpleJobLauncherTests {
|
||||
|
||||
@Test
|
||||
public void testInitialiseWithRepository() throws Exception {
|
||||
jobLauncher = new SimpleJobLauncher();
|
||||
jobLauncher = new TaskExecutorJobLauncher();
|
||||
jobLauncher.setJobRepository(jobRepository);
|
||||
jobLauncher.afterPropertiesSet(); // no error
|
||||
}
|
||||
@@ -311,7 +311,7 @@ public class SimpleJobLauncherTests {
|
||||
when(jobExecution.getStepExecutions()).thenReturn(Arrays.asList(stepExecution));
|
||||
|
||||
// setup launcher
|
||||
jobLauncher = new SimpleJobLauncher();
|
||||
jobLauncher = new TaskExecutorJobLauncher();
|
||||
jobLauncher.setJobRepository(jobRepository);
|
||||
|
||||
// run
|
||||
@@ -206,8 +206,8 @@ public abstract class AbstractJobExecutionDaoTests {
|
||||
|
||||
// BATCH-2675
|
||||
// Abnormal JobExecution as both StartTime and EndTime are null
|
||||
// This can occur when SimpleJobLauncher#run() submission to taskExecutor throws a
|
||||
// TaskRejectedException
|
||||
// This can occur when TaskExecutorJobLauncher#run() submission to taskExecutor
|
||||
// throws a TaskRejectedException
|
||||
exec = new JobExecution(jobInstance, jobParameters);
|
||||
exec.setLastUpdated(new Date(5L));
|
||||
dao.saveJobExecution(exec);
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.UnexpectedJobExecutionException;
|
||||
import org.springframework.batch.core.job.JobSupport;
|
||||
import org.springframework.batch.core.launch.support.SimpleJobLauncher;
|
||||
import org.springframework.batch.core.launch.support.TaskExecutorJobLauncher;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
@@ -66,7 +66,7 @@ public class JobStepTests {
|
||||
JobExecution jobExecution = jobRepository.createJobExecution("job", new JobParameters());
|
||||
stepExecution = jobExecution.createStepExecution("step");
|
||||
jobRepository.add(stepExecution);
|
||||
SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
|
||||
TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher();
|
||||
jobLauncher.setJobRepository(jobRepository);
|
||||
jobLauncher.afterPropertiesSet();
|
||||
step.setJobLauncher(jobLauncher);
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
<property name="taskExecutor" ref="taskExecutor" />
|
||||
</bean>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
<bean id="tasklet" class="org.springframework.batch.core.configuration.xml.FailingTasklet"/>
|
||||
|
||||
<bean class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<beans:bean id="jobParametersExtractor" class="org.springframework.batch.core.step.job.DefaultJobParametersExtractor"/>
|
||||
|
||||
<beans:bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<beans:bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<beans:property name="jobRepository" ref="jobRepository"/>
|
||||
</beans:bean>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<bean id="tasklet" class="org.springframework.batch.core.configuration.xml.FailingTasklet"/>
|
||||
|
||||
<bean class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="jobLauncher"
|
||||
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
<bean id="jobRepository"
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<bean id="itemWriter" class="org.springframework.batch.core.repository.dao.OptimisticLockingFailureTests$Writer"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
<property name="taskExecutor">
|
||||
<bean class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<batch:job-repository id="jobRepository"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<batch:job-repository id="jobRepository" table-prefix="BATCH_"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
<batch:job-repository id="jobRepository" table-prefix="BATCH_"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
<batch:job-repository id="jobRepository" table-prefix="BATCH_"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -141,7 +141,7 @@
|
||||
|
||||
<bean id="tasklet" class="org.springframework.batch.core.step.item.ExceptionThrowingTaskletStub"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<beans:property name="dataSource" ref="dataSource"/>
|
||||
</beans:bean>
|
||||
|
||||
<beans:bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"
|
||||
<beans:bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher"
|
||||
p:jobRepository-ref="jobRepository"/>
|
||||
|
||||
<beans:bean id="reader" class="org.springframework.batch.item.support.ListItemReader">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
http://www.springframework.org/schema/batch https://www.springframework.org/schema/batch/spring-batch.xsd
|
||||
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<import resource="data-source-context.xml" />
|
||||
|
||||
<bean id="jobLauncher"
|
||||
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -810,25 +810,25 @@ on and wire one up manually in the normal Spring way.
|
||||
When you use `@EnableBatchProcessing`, a `JobRegistry` is provided for you.
|
||||
This section describes how to configure your own.
|
||||
|
||||
The most basic implementation of the `JobLauncher` interface is the `SimpleJobLauncher`.
|
||||
The most basic implementation of the `JobLauncher` interface is the `TaskExecutorJobLauncher`.
|
||||
Its only required dependency is a `JobRepository` (needed to obtain an execution).
|
||||
|
||||
[role="xmlContent"]
|
||||
The following example shows a `SimpleJobLauncher` in XML:
|
||||
The following example shows a `TaskExecutorJobLauncher` in XML:
|
||||
|
||||
.XML Configuration
|
||||
====
|
||||
[source, xml, role="xmlContent"]
|
||||
----
|
||||
<bean id="jobLauncher"
|
||||
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
----
|
||||
====
|
||||
|
||||
[role="javaContent"]
|
||||
The following example shows a `SimpleJobLauncher` in Java:
|
||||
The following example shows a `TaskExecutorJobLauncher` in Java:
|
||||
|
||||
.Java Configuration
|
||||
====
|
||||
@@ -838,7 +838,7 @@ The following example shows a `SimpleJobLauncher` in Java:
|
||||
// This would reside in your BatchConfigurer implementation
|
||||
@Override
|
||||
protected JobLauncher createJobLauncher() throws Exception {
|
||||
SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
|
||||
TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher();
|
||||
jobLauncher.setJobRepository(jobRepository);
|
||||
jobLauncher.afterPropertiesSet();
|
||||
return jobLauncher;
|
||||
@@ -856,7 +856,7 @@ image::{batch-asciidoc}images/job-launcher-sequence-sync.png[Job Launcher Sequen
|
||||
|
||||
The sequence is straightforward and works well when launched from a scheduler. However,
|
||||
issues arise when trying to launch from an HTTP request. In this scenario, the launching
|
||||
needs to be done asynchronously so that the `SimpleJobLauncher` returns immediately to its
|
||||
needs to be done asynchronously so that the `TaskExecutorJobLauncher` returns immediately to its
|
||||
caller. This is because it is not good practice to keep an HTTP request open for the
|
||||
amount of time needed by long running processes (such as batch jobs). The following image shows
|
||||
an example sequence:
|
||||
@@ -864,18 +864,18 @@ an example sequence:
|
||||
.Asynchronous Job Launcher Sequence
|
||||
image::{batch-asciidoc}images/job-launcher-sequence-async.png[Async Job Launcher Sequence, scaledwidth="60%"]
|
||||
|
||||
You can configure the `SimpleJobLauncher` to allow for this scenario by configuring a
|
||||
You can configure the `TaskExecutorJobLauncher` to allow for this scenario by configuring a
|
||||
`TaskExecutor`.
|
||||
|
||||
[role="xmlContent"]
|
||||
The following XML example configures a `SimpleJobLauncher` to return immediately:
|
||||
The following XML example configures a `TaskExecutorJobLauncher` to return immediately:
|
||||
|
||||
.XML Configuration
|
||||
====
|
||||
[source, xml, role="xmlContent"]
|
||||
----
|
||||
<bean id="jobLauncher"
|
||||
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
<property name="taskExecutor">
|
||||
<bean class="org.springframework.core.task.SimpleAsyncTaskExecutor" />
|
||||
@@ -885,7 +885,7 @@ The following XML example configures a `SimpleJobLauncher` to return immediately
|
||||
====
|
||||
|
||||
[role="javaContent"]
|
||||
The following Java example configures a `SimpleJobLauncher` to return immediately:
|
||||
The following Java example configures a `TaskExecutorJobLauncher` to return immediately:
|
||||
|
||||
.Java Configuration
|
||||
====
|
||||
@@ -893,7 +893,7 @@ The following Java example configures a `SimpleJobLauncher` to return immediatel
|
||||
----
|
||||
@Bean
|
||||
public JobLauncher jobLauncher() {
|
||||
SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
|
||||
TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher();
|
||||
jobLauncher.setJobRepository(jobRepository());
|
||||
jobLauncher.setTaskExecutor(new SimpleAsyncTaskExecutor());
|
||||
jobLauncher.afterPropertiesSet();
|
||||
@@ -1034,7 +1034,7 @@ The following example shows a sample configuration for `endOfDay` in XML:
|
||||
|
||||
<!-- Launcher details removed for clarity -->
|
||||
<beans:bean id="jobLauncher"
|
||||
class="org.springframework.batch.core.launch.support.SimpleJobLauncher" />
|
||||
class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher" />
|
||||
----
|
||||
====
|
||||
|
||||
@@ -1105,7 +1105,7 @@ The following example shows a sample configuration for `endOfDay` in XML:
|
||||
|
||||
<!-- Launcher details removed for clarity -->
|
||||
<beans:bean id="jobLauncher"
|
||||
class="org.springframework.batch.core.launch.support.SimpleJobLauncher" />
|
||||
class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher" />
|
||||
----
|
||||
====
|
||||
|
||||
|
||||
@@ -275,10 +275,10 @@ public FileMessageToJobRequest fileMessageToJobRequest() {
|
||||
|
||||
@Bean
|
||||
public JobLaunchingGateway jobLaunchingGateway() {
|
||||
SimpleJobLauncher simpleJobLauncher = new SimpleJobLauncher();
|
||||
simpleJobLauncher.setJobRepository(jobRepository);
|
||||
simpleJobLauncher.setTaskExecutor(new SyncTaskExecutor());
|
||||
JobLaunchingGateway jobLaunchingGateway = new JobLaunchingGateway(simpleJobLauncher);
|
||||
TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher();
|
||||
jobLauncher.setJobRepository(jobRepository);
|
||||
jobLauncher.setTaskExecutor(new SyncTaskExecutor());
|
||||
JobLaunchingGateway jobLaunchingGateway = new JobLaunchingGateway(jobLauncher);
|
||||
|
||||
return jobLaunchingGateway;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
<batch:job-repository id="jobRepository" table-prefix="BATCH_"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
|
||||
<batch:job-repository id="jobRepository" />
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
|
||||
<batch:job-repository id="jobRepository" table-prefix="BATCH_"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -693,7 +693,7 @@ bean is different from the other samples only in that it uses an
|
||||
asynchronous task executor, so that the jobs are launched in a
|
||||
separate thread to the main method:
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
<property name="taskExecutor">
|
||||
<bean class="org.springframework.core.task.SimpleAsyncTaskExecutor" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!-- The tasklet used in this job will run in an infinite loop. This is useful for testing graceful shutdown from
|
||||
multiple environments. -->
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
<property name="taskExecutor">
|
||||
<bean class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<import
|
||||
resource="classpath:/org/springframework/batch/sample/config/common-context.xml" />
|
||||
<bean id="jobLauncher"
|
||||
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<import resource="data-source-context.xml" />
|
||||
<import resource="classpath:/org/springframework/batch/sample/config/common-context.xml" />
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="jobLauncher"
|
||||
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
</bean>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user