diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java index 3b0582ac0..534e4e7ff 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBean.java @@ -34,6 +34,7 @@ import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ItemWriter; import org.springframework.batch.repeat.CompletionPolicy; import org.springframework.batch.repeat.policy.SimpleCompletionPolicy; +import org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate; import org.springframework.batch.retry.RetryListener; import org.springframework.batch.retry.policy.MapRetryContextCache; import org.springframework.beans.factory.BeanNameAware; @@ -108,6 +109,8 @@ class StepParserStepFactoryBean implements FactoryBean, BeanNameAware { private TaskExecutor taskExecutor; + private Integer throttleLimit; + private ItemReader itemReader; private ItemProcessor itemProcessor; @@ -204,6 +207,9 @@ class StepParserStepFactoryBean implements FactoryBean, BeanNameAware { if (taskExecutor != null) { fb.setTaskExecutor(taskExecutor); } + if (throttleLimit != null) { + fb.setThrottleLimit(throttleLimit); + } if (itemReader != null) { fb.setItemReader(itemReader); } @@ -574,6 +580,18 @@ class StepParserStepFactoryBean implements FactoryBean, BeanNameAware { this.taskExecutor = taskExecutor; } + /** + * Public setter for the throttle limit. This limits the number of tasks + * queued for concurrent processing to prevent thread pools from being + * overwhelmed. Defaults to + * {@link TaskExecutorRepeatTemplate#DEFAULT_THROTTLE_LIMIT}. + * + * @param throttleLimit the throttle limit to set. + */ + public void setThrottleLimit(Integer throttleLimit) { + this.throttleLimit = throttleLimit; + } + /** * @param itemReader the {@link ItemReader} to set */ diff --git a/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd b/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd index 5b2b00f0a..9f8241f3d 100644 --- a/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd +++ b/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd @@ -567,6 +567,15 @@ + + + + +