From 9be8a107912bb4fbfb5e667baac918bda5d97c73 Mon Sep 17 00:00:00 2001 From: Marvin Deng Date: Mon, 13 Jun 2022 22:48:46 +0800 Subject: [PATCH] Rename SimpleJobLauncher to TaskExecutorJobLauncher Resolves #4123 --- .../annotation/DefaultBatchConfigurer.java | 4 +-- .../annotation/EnableBatchProcessing.java | 7 +++-- ...cher.java => TaskExecutorJobLauncher.java} | 4 +-- .../core/step/builder/JobStepBuilder.java | 4 +-- ...java => TaskExecutorJobLauncherTests.java} | 14 +++++----- .../dao/AbstractJobExecutionDaoTests.java | 3 ++- .../batch/core/step/job/JobStepTests.java | 4 +-- .../resources/applicationContext-test2.xml | 2 +- .../JobRegistryIntegrationTests-context.xml | 2 +- .../xml/JobStepParserTests-context.xml | 2 +- .../JobLauncherIntegrationTests-context.xml | 2 +- .../batch/core/partition/launch-context.xml | 2 +- .../OptimisticLockingFailureTests-context.xml | 2 +- .../dao/TablePrefixTests-context.xml | 2 +- ...stPreparedStatementSetterTests-context.xml | 2 +- .../CommitIntervalJobParameter-context.xml | 2 +- .../step/RestartInPriorStepTests-context.xml | 2 +- .../core/step/RestartLoopTests-context.xml | 2 +- ...tTolerantExceptionClassesTests-context.xml | 2 +- .../item/ScriptItemProcessorTests-context.xml | 2 +- .../skip/ReprocessExceptionTests-context.xml | 2 +- .../resources/simple-job-launcher-context.xml | 2 +- spring-batch-docs/src/main/asciidoc/job.adoc | 26 +++++++++---------- .../asciidoc/spring-batch-integration.adoc | 8 +++--- ...ltTolerantStepIntegrationTests-context.xml | 2 +- ...lerantStepJdbcIntegrationTests-context.xml | 2 +- ...olerantStepJmsIntegrationTests-context.xml | 2 +- ...emoteChunkStepIntegrationTests-context.xml | 2 +- ...JobLaunchingGatewayParserTests-context.xml | 2 +- ...chingGatewayParserTestsRunning-context.xml | 2 +- .../resources/simple-job-launcher-context.xml | 2 +- spring-batch-samples/README.md | 2 +- .../main/resources/jobs/infiniteLoopJob.xml | 2 +- .../resources/simple-job-launcher-context.xml | 2 +- .../skipSample-job-launcher-context.xml | 2 +- .../resources/simple-job-launcher-context.xml | 2 +- 36 files changed, 64 insertions(+), 64 deletions(-) rename spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/{SimpleJobLauncher.java => TaskExecutorJobLauncher.java} (98%) rename spring-batch-core/src/test/java/org/springframework/batch/core/launch/{SimpleJobLauncherTests.java => TaskExecutorJobLauncherTests.java} (96%) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/DefaultBatchConfigurer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/DefaultBatchConfigurer.java index 39bd845e2f..179bcbdc5d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/DefaultBatchConfigurer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/DefaultBatchConfigurer.java @@ -22,7 +22,7 @@ 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.jdbc.datasource.DataSourceTransactionManager; @@ -126,7 +126,7 @@ public void initialize() { * 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; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/EnableBatchProcessing.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/EnableBatchProcessing.java index c23a31383e..d7598ccb4e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/EnableBatchProcessing.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/EnableBatchProcessing.java @@ -26,10 +26,9 @@ 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; /** *

@@ -102,7 +101,7 @@ *

  • a {@link JobRepository} (bean name "jobRepository" of type * {@link org.springframework.batch.core.repository.support.SimpleJobRepository})
  • *
  • a {@link JobLauncher} (bean name "jobLauncher" of type - * {@link org.springframework.batch.core.launch.support.SimpleJobLauncher})
  • + * {@link TaskExecutorJobLauncher}) *
  • a {@link JobRegistry} (bean name "jobRegistry" of type * {@link org.springframework.batch.core.configuration.support.MapJobRegistry})
  • *
  • a {@link org.springframework.batch.core.explore.JobExplorer} (bean name @@ -190,7 +189,7 @@ * * * +"org.springframework.batch.core.launch.support.TaskExecutorJobLauncher"> * * * diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJobLauncher.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/TaskExecutorJobLauncher.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJobLauncher.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/TaskExecutorJobLauncher.java index 60fe460c55..3af63796f0 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJobLauncher.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/TaskExecutorJobLauncher.java @@ -62,9 +62,9 @@ * @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; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/JobStepBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/JobStepBuilder.java index 13a132561a..7cfc118933 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/JobStepBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/JobStepBuilder.java @@ -18,7 +18,7 @@ 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 Step build() { step.setJobParametersExtractor(jobParametersExtractor); } if (jobLauncher == null) { - SimpleJobLauncher jobLauncher = new SimpleJobLauncher(); + TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher(); jobLauncher.setJobRepository(getJobRepository()); try { jobLauncher.afterPropertiesSet(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/SimpleJobLauncherTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/TaskExecutorJobLauncherTests.java similarity index 96% rename from spring-batch-core/src/test/java/org/springframework/batch/core/launch/SimpleJobLauncherTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/launch/TaskExecutorJobLauncherTests.java index 4a9b1f5cf4..55681ec9e0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/SimpleJobLauncherTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/TaskExecutorJobLauncherTests.java @@ -40,7 +40,7 @@ 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 @@ * @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 void execute(JobExecution execution) { @Before public void setUp() throws Exception { - jobLauncher = new SimpleJobLauncher(); + jobLauncher = new TaskExecutorJobLauncher(); jobRepository = mock(JobRepository.class); jobLauncher.setJobRepository(jobRepository); @@ -233,7 +233,7 @@ public void execute(JobExecution execution) { @Test public void testInitialiseWithoutRepository() throws Exception { try { - new SimpleJobLauncher().afterPropertiesSet(); + new TaskExecutorJobLauncher().afterPropertiesSet(); fail("Expected IllegalArgumentException"); } catch (IllegalStateException e) { @@ -245,7 +245,7 @@ public void testInitialiseWithoutRepository() throws Exception { @Test public void testInitialiseWithRepository() throws Exception { - jobLauncher = new SimpleJobLauncher(); + jobLauncher = new TaskExecutorJobLauncher(); jobLauncher.setJobRepository(jobRepository); jobLauncher.afterPropertiesSet(); // no error } @@ -311,7 +311,7 @@ private void testRestartStepExecutionInvalidStatus(BatchStatus status) throws Ex when(jobExecution.getStepExecutions()).thenReturn(Arrays.asList(stepExecution)); // setup launcher - jobLauncher = new SimpleJobLauncher(); + jobLauncher = new TaskExecutorJobLauncher(); jobLauncher.setJobRepository(jobRepository); // run diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java index 752dfe2307..2b4372396e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractJobExecutionDaoTests.java @@ -206,7 +206,8 @@ public void testFindRunningExecutions() { // BATCH-2675 // Abnormal JobExecution as both StartTime and EndTime are null - // This can occur when SimpleJobLauncher#run() submission to taskExecutor throws a + // This can occur when TaskExecutorJobLauncher#run() submission to taskExecutor + // throws a // TaskRejectedException exec = new JobExecution(jobInstance, jobParameters); exec.setLastUpdated(new Date(5L)); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/job/JobStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/job/JobStepTests.java index a740727989..ff541e35cc 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/job/JobStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/job/JobStepTests.java @@ -27,7 +27,7 @@ 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 void setUp() throws Exception { 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); diff --git a/spring-batch-core/src/test/resources/applicationContext-test2.xml b/spring-batch-core/src/test/resources/applicationContext-test2.xml index 720f7b7e56..eef6d2a22c 100644 --- a/spring-batch-core/src/test/resources/applicationContext-test2.xml +++ b/spring-batch-core/src/test/resources/applicationContext-test2.xml @@ -46,7 +46,7 @@ - + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/support/JobRegistryIntegrationTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/support/JobRegistryIntegrationTests-context.xml index 4eb4127df8..36da776423 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/support/JobRegistryIntegrationTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/support/JobRegistryIntegrationTests-context.xml @@ -34,7 +34,7 @@ - + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/JobStepParserTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/JobStepParserTests-context.xml index 53b3ff8a4b..aba01b79cf 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/JobStepParserTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/JobStepParserTests-context.xml @@ -32,7 +32,7 @@ - + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/JobLauncherIntegrationTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/JobLauncherIntegrationTests-context.xml index fe3b13ea0d..6e505954bf 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/JobLauncherIntegrationTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/JobLauncherIntegrationTests-context.xml @@ -12,7 +12,7 @@ - + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/partition/launch-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/partition/launch-context.xml index 390be7d282..2fdbc767eb 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/partition/launch-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/partition/launch-context.xml @@ -67,7 +67,7 @@ + class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher"> - + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/repository/dao/TablePrefixTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/repository/dao/TablePrefixTests-context.xml index a462c65b2b..78bbd73c0c 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/repository/dao/TablePrefixTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/repository/dao/TablePrefixTests-context.xml @@ -15,7 +15,7 @@ - + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/resource/ListPreparedStatementSetterTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/resource/ListPreparedStatementSetterTests-context.xml index 6ab3e35b5c..3c6aee9ac4 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/resource/ListPreparedStatementSetterTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/resource/ListPreparedStatementSetterTests-context.xml @@ -17,7 +17,7 @@ - + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/context/CommitIntervalJobParameter-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/context/CommitIntervalJobParameter-context.xml index 9cba5d986f..b9a0712978 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/context/CommitIntervalJobParameter-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/context/CommitIntervalJobParameter-context.xml @@ -19,7 +19,7 @@ - + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/step/RestartInPriorStepTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/step/RestartInPriorStepTests-context.xml index c9074c0a72..a3325e1950 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/step/RestartInPriorStepTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/step/RestartInPriorStepTests-context.xml @@ -87,7 +87,7 @@ - + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/step/RestartLoopTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/step/RestartLoopTests-context.xml index 5669ccfd01..25cea62b4f 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/step/RestartLoopTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/step/RestartLoopTests-context.xml @@ -36,7 +36,7 @@ - + \ No newline at end of file diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests-context.xml index 375552ab94..07b730e202 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/step/item/FaultTolerantExceptionClassesTests-context.xml @@ -141,7 +141,7 @@ - + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/step/item/ScriptItemProcessorTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/step/item/ScriptItemProcessorTests-context.xml index 07535e8729..6782e6dd4b 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/step/item/ScriptItemProcessorTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/step/item/ScriptItemProcessorTests-context.xml @@ -32,7 +32,7 @@ - diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/step/skip/ReprocessExceptionTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/step/skip/ReprocessExceptionTests-context.xml index c9ecc60ccc..554023d8bb 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/step/skip/ReprocessExceptionTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/step/skip/ReprocessExceptionTests-context.xml @@ -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"> - + diff --git a/spring-batch-core/src/test/resources/simple-job-launcher-context.xml b/spring-batch-core/src/test/resources/simple-job-launcher-context.xml index 8ddb088ee3..b889f08724 100644 --- a/spring-batch-core/src/test/resources/simple-job-launcher-context.xml +++ b/spring-batch-core/src/test/resources/simple-job-launcher-context.xml @@ -7,7 +7,7 @@ + class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher"> diff --git a/spring-batch-docs/src/main/asciidoc/job.adoc b/spring-batch-docs/src/main/asciidoc/job.adoc index 2933332250..d0df6f64af 100644 --- a/spring-batch-docs/src/main/asciidoc/job.adoc +++ b/spring-batch-docs/src/main/asciidoc/job.adoc @@ -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"] ---- + class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher"> ---- ==== [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"] ---- + class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher"> @@ -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: + class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher" /> ---- ==== @@ -1105,7 +1105,7 @@ The following example shows a sample configuration for `endOfDay` in XML: + class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher" /> ---- ==== diff --git a/spring-batch-docs/src/main/asciidoc/spring-batch-integration.adoc b/spring-batch-docs/src/main/asciidoc/spring-batch-integration.adoc index cd4f41816c..9464753547 100644 --- a/spring-batch-docs/src/main/asciidoc/spring-batch-integration.adoc +++ b/spring-batch-docs/src/main/asciidoc/spring-batch-integration.adoc @@ -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; } diff --git a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepIntegrationTests-context.xml b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepIntegrationTests-context.xml index 46890c505e..73094543c9 100644 --- a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepIntegrationTests-context.xml +++ b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepIntegrationTests-context.xml @@ -89,7 +89,7 @@ - + diff --git a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepJdbcIntegrationTests-context.xml b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepJdbcIntegrationTests-context.xml index e1bb140eb5..f37456b59e 100644 --- a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepJdbcIntegrationTests-context.xml +++ b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepJdbcIntegrationTests-context.xml @@ -128,7 +128,7 @@ - + diff --git a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepJmsIntegrationTests-context.xml b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepJmsIntegrationTests-context.xml index 0fbbb04cfa..ed6581a8e8 100644 --- a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepJmsIntegrationTests-context.xml +++ b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkFaultTolerantStepJmsIntegrationTests-context.xml @@ -118,7 +118,7 @@ - + diff --git a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkStepIntegrationTests-context.xml b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkStepIntegrationTests-context.xml index c302a604b4..b301ed2962 100644 --- a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkStepIntegrationTests-context.xml +++ b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/chunk/RemoteChunkStepIntegrationTests-context.xml @@ -78,7 +78,7 @@ - + diff --git a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/config/xml/JobLaunchingGatewayParserTests-context.xml b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/config/xml/JobLaunchingGatewayParserTests-context.xml index 64b1146634..c389d4ce56 100644 --- a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/config/xml/JobLaunchingGatewayParserTests-context.xml +++ b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/config/xml/JobLaunchingGatewayParserTests-context.xml @@ -14,7 +14,7 @@ - + diff --git a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/config/xml/JobLaunchingGatewayParserTestsRunning-context.xml b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/config/xml/JobLaunchingGatewayParserTestsRunning-context.xml index 7dc6b4d536..44d4170f94 100644 --- a/spring-batch-integration/src/test/resources/org/springframework/batch/integration/config/xml/JobLaunchingGatewayParserTestsRunning-context.xml +++ b/spring-batch-integration/src/test/resources/org/springframework/batch/integration/config/xml/JobLaunchingGatewayParserTestsRunning-context.xml @@ -14,7 +14,7 @@ - + diff --git a/spring-batch-integration/src/test/resources/simple-job-launcher-context.xml b/spring-batch-integration/src/test/resources/simple-job-launcher-context.xml index 1373b6640c..bb40c82b23 100644 --- a/spring-batch-integration/src/test/resources/simple-job-launcher-context.xml +++ b/spring-batch-integration/src/test/resources/simple-job-launcher-context.xml @@ -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"> - + diff --git a/spring-batch-samples/README.md b/spring-batch-samples/README.md index 5c24aee133..90b851f942 100644 --- a/spring-batch-samples/README.md +++ b/spring-batch-samples/README.md @@ -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: - + diff --git a/spring-batch-samples/src/main/resources/jobs/infiniteLoopJob.xml b/spring-batch-samples/src/main/resources/jobs/infiniteLoopJob.xml index 53ad9ab963..560d3f1c70 100644 --- a/spring-batch-samples/src/main/resources/jobs/infiniteLoopJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/infiniteLoopJob.xml @@ -6,7 +6,7 @@ - + diff --git a/spring-batch-samples/src/main/resources/simple-job-launcher-context.xml b/spring-batch-samples/src/main/resources/simple-job-launcher-context.xml index d6fc99a56b..bbf14928f5 100644 --- a/spring-batch-samples/src/main/resources/simple-job-launcher-context.xml +++ b/spring-batch-samples/src/main/resources/simple-job-launcher-context.xml @@ -7,7 +7,7 @@ + class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher"> diff --git a/spring-batch-samples/src/main/resources/skipSample-job-launcher-context.xml b/spring-batch-samples/src/main/resources/skipSample-job-launcher-context.xml index 39307ffcb8..0840a92629 100644 --- a/spring-batch-samples/src/main/resources/skipSample-job-launcher-context.xml +++ b/spring-batch-samples/src/main/resources/skipSample-job-launcher-context.xml @@ -7,7 +7,7 @@ - + diff --git a/spring-batch-test/src/test/resources/simple-job-launcher-context.xml b/spring-batch-test/src/test/resources/simple-job-launcher-context.xml index 09fa67a15f..237e3aadd9 100755 --- a/spring-batch-test/src/test/resources/simple-job-launcher-context.xml +++ b/spring-batch-test/src/test/resources/simple-job-launcher-context.xml @@ -10,7 +10,7 @@ + class="org.springframework.batch.core.launch.support.TaskExecutorJobLauncher">