我正在尝试使用Spring批处理中的单个Job并行执行多个步骤。这是我的配置的外观。
<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个线程。由于这个原因,一些步骤没有被执行,而且我正在获得所有线程运行的潜力。不知道这里出了什么问题。
答案 0 :(得分:0)
可能为时已晚,无法回答。但也许可以帮助其他人解决同样的问题。
如果你已经将spring批处理管理项目与spring批处理应用程序集成在一起,那么就是那个将线程数限制为8的管理员。我删除了spring批处理管理依赖项并将我的spring批处理作为一个简单的spring web应用程序,现在线程数越过8并达到maxpoolsize。
另外要提一下的是查看tasklet标记中的限制限制配置。