BATCH-1081: Added task-executor to <split> element in namespace
This commit is contained in:
@@ -20,9 +20,11 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.ManagedList;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
@@ -70,6 +72,12 @@ public class SplitParser {
|
||||
BeanDefinitionBuilder stateBuilder =
|
||||
BeanDefinitionBuilder.genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.SplitState");
|
||||
|
||||
String taskExecutorBeanId = element.getAttribute("task-executor");
|
||||
if (StringUtils.hasText(taskExecutorBeanId)) {
|
||||
RuntimeBeanReference taskExecutorRef = new RuntimeBeanReference(taskExecutorBeanId);
|
||||
stateBuilder.addPropertyValue("taskExecutor", taskExecutorRef);
|
||||
}
|
||||
|
||||
Collection<BeanDefinition> flows = new ArrayList<BeanDefinition>();
|
||||
int i = 0;
|
||||
for (Element nextElement : flowElements) {
|
||||
|
||||
@@ -167,6 +167,20 @@
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="id" type="xsd:ID" use="required" />
|
||||
<xsd:attribute name="task-executor" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation
|
||||
source="java:org.springframework.core.task.TaskExecutor"><![CDATA[
|
||||
The task executor responsible for executing the task..
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type
|
||||
type="org.springframework.core.task.TaskExecutor" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<beans:import resource="common-context.xml" />
|
||||
|
||||
<job id="job">
|
||||
<split id="split1">
|
||||
<split id="split1" task-executor="taskExecutor">
|
||||
<flow>
|
||||
<step id="fail" ref="failingStep">
|
||||
<fail on="FAILED"/>
|
||||
@@ -20,6 +20,8 @@
|
||||
<step id="s1" ref="step1"/>
|
||||
</flow>
|
||||
</split>
|
||||
</job>
|
||||
</job>
|
||||
|
||||
<beans:bean id="taskExecutor" class="org.springframework.core.task.SyncTaskExecutor" />
|
||||
|
||||
</beans:beans>
|
||||
</beans:beans>
|
||||
|
||||
Reference in New Issue
Block a user