
Originally Posted by
Benny Jiang
In Spring Batch, the jobLauncher in default is using synchronized taskExecutor, which means the jobs you run with this launcher will run in sequential.
Hi thanks. This is what I thought would happen, but in testing I fire up to 10 jobs (I believe this is the thread limit).
Code:
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<bean id="repeat" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="repeatDetail" />
<property name="startDelay" value="5001" />
<property name="repeatInterval" value="100"/>
</bean>
</list>
</property>
</bean>
<bean id="minuteRepeatDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="foo.JobLauncherDetails" />
<property name="group" value="repeat" />
<property name="jobDataAsMap">
<map>
<entry key="jobName" value="minuteRepeatJob"/>
<entry key="jobLocator" value-ref="jobRegistry"/>
<entry key="jobLauncher" value-ref="jobLauncher"/>
</map>
</property>
</bean>
<batch:job id="minuteRepeatJob" restartable="true" incrementer="runIdIncrementer">
<batch:step id="harvestSchedule" next="explodeXMLRecords">
<batch:tasklet ref="harvestScheduler" />
</batch:step>
<batch:step id="explodeXMLRecords">
<batch:tasklet>
<batch:chunk reader="xmlExploderItemReader" processor="xmlExploderItemProcessor" writer="xmlExploderItemWriter" commit-interval="1000" />
</batch:tasklet>
</batch:step>
</batch:job>
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
<property name="taskExecutor">
<bean class="org.springframework.core.task.SyncTaskExecutor" />
</property>
</bean>
10:45:28,718 [INFO ] org.springframework.batch.core.launch.support.Simp leJobLauncher [run():118] - Job: [FlowJob: [name=minuteRepeatJob]] launched with the following parameters: [{run.id=1281087928093}]
10:45:28,718 [INFO ] org.springframework.batch.core.launch.support.Simp leJobLauncher [run():118] - Job: [FlowJob: [name=minuteRepeatJob]] launched with the following parameters: [{run.id=1281087927343}]
10:45:28,765 [INFO ] org.springframework.batch.core.launch.support.Simp leJobLauncher [run():118] - Job: [FlowJob: [name=minuteRepeatJob]] launched with the following parameters: [{run.id=1281087928687}]
Is this maybe something to do with the incrementor I am using or is the fact I trigger using quartz the culprit?