我正在尝试使用 Spring 批处理中的单个作业并行执行多个步骤。这是我的配置的外观。
<job id="gmegdc1" xmlns="http://www.springframework.org/schema/batch" >
<split id="splitStep" task-executor="taskExecutor">
<flow>
<step id="step1" parent="simpleStep1">
<tasklet ref="gdcTasklet1" task-executor="taskExecutor1" throttle-limit="6" />
</step>
</flow>
<flow>
<step id="step2" parent="simpleStep2">
<tasklet ref="gdcTasklet2" task-executor="taskExecutor2" throttle-limit="6" />
</step>
</flow>
<flow>
<step id="step3" parent="simpleStep3">
<tasklet ref="gdcTasklet3" task-executor="taskExecutor3" throttle-limit="6" />
</step>
</flow>
<flow>
<step id="step4" parent="simpleStep4">
<tasklet ref="gdcTasklet4" task-executor="taskExecutor4" throttle-limit="6" />
</step>
</flow>
</split>
</job>
<bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="25" />
<property name="maxPoolSize" value="25" />
</bean>
<bean id="taskExecutor1" class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
<bean id="taskExecutor2" class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
<bean id="taskExecutor3" class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
<bean id="taskExecutor4" class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
我想为每个步骤运行 6 个线程。使用这种配置,每次我开始作业时,一次只运行 8 个不同步骤组合的线程。由于这个原因,一些步骤没有被执行,我也得到了所有线程运行的潜力。不知道这里出了什么问题。