Skip to content

Rename SimpleJobLauncher to TaskExecutorJobLauncher #4131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
* <p>
Expand Down Expand Up @@ -102,7 +101,7 @@
* <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
Expand Down Expand Up @@ -190,7 +189,7 @@
* </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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
* @see JobRepository
* @see TaskExecutor
*/
public class SimpleJobLauncher implements JobLauncher, InitializingBean {
public class TaskExecutorJobLauncher implements JobLauncher, InitializingBean {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For such a widely used class, it is preferable to proceed with a deprecation in v5.0 (followed by a removal in 5.2) instead of a complete removal in one go. I will take care of this when merging the PR.


protected static final Log logger = LogFactory.getLog(SimpleJobLauncher.class);
protected static final Log logger = LogFactory.getLog(TaskExecutorJobLauncher.class);

private JobRepository jobRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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);

Expand Down Expand Up @@ -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) {
Expand All @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +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
// 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Loading