OPEN - issue BATCH-398: That old stateful / stateless things again....
http://jira.springframework.org/browse/BATCH-398 Split up config for TaskExecutorLauncher a bit. Heading for a more rational approach based on a new application context per run.
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/aop
|
||||
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
|
||||
|
||||
<import resource="simple-container-definition.xml" />
|
||||
|
||||
<bean class="org.springframework.jmx.export.MBeanExporter">
|
||||
<property name="beans">
|
||||
<map>
|
||||
<entry key="spring:service=batch,bean=jobLauncher">
|
||||
<bean
|
||||
class="org.springframework.batch.execution.bootstrap.support.SimpleExportedJobLauncher">
|
||||
<property name="launcher" ref="jobLauncher" />
|
||||
<property name="jobLocator"
|
||||
ref="jobConfigurationRegistry" />
|
||||
</bean>
|
||||
</entry>
|
||||
<entry
|
||||
key="spring:service=batch,bean=notificationPublisher"
|
||||
value-ref="notificationPublisher" />
|
||||
<entry
|
||||
key="spring:service=batch,bean=configurationLoader"
|
||||
value-ref="loader" />
|
||||
</map>
|
||||
</property>
|
||||
<property name="assembler">
|
||||
<bean
|
||||
class="org.springframework.jmx.export.assembler.InterfaceBasedMBeanInfoAssembler">
|
||||
<property name="interfaceMappings">
|
||||
<map>
|
||||
<entry
|
||||
key="spring:service=batch,bean=jobLauncher"
|
||||
value="org.springframework.batch.execution.bootstrap.support.ExportedJobLauncher" />
|
||||
<entry key="spring:service=batch,bean=jobLoader"
|
||||
value="org.springframework.batch.sample.JobLoader" />
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="notificationPublisher"
|
||||
class="org.springframework.batch.sample.advice.JobExecutionNotificationPublisher" />
|
||||
|
||||
<bean id="jobLauncher"
|
||||
class="org.springframework.batch.execution.launch.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
<property name="taskExecutor">
|
||||
<bean
|
||||
class="org.springframework.core.task.SimpleAsyncTaskExecutor" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="loader"
|
||||
class="org.springframework.batch.sample.DefaultJobLoader">
|
||||
<property name="registry" ref="jobConfigurationRegistry" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -24,43 +24,6 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.jmx.export.MBeanExporter">
|
||||
<property name="beans">
|
||||
<map>
|
||||
<entry key="spring:service=batch,bean=jobLauncher">
|
||||
<bean
|
||||
class="org.springframework.batch.execution.bootstrap.support.SimpleExportedJobLauncher">
|
||||
<property name="launcher" ref="jobLauncher" />
|
||||
<property name="jobLocator"
|
||||
ref="jobConfigurationRegistry" />
|
||||
</bean>
|
||||
</entry>
|
||||
<entry
|
||||
key="spring:service=batch,bean=notificationPublisher"
|
||||
value-ref="notificationPublisher" />
|
||||
<entry
|
||||
key="spring:service=batch,bean=configurationLoader" value-ref="loader" />
|
||||
</map>
|
||||
</property>
|
||||
<property name="assembler">
|
||||
<bean
|
||||
class="org.springframework.jmx.export.assembler.InterfaceBasedMBeanInfoAssembler">
|
||||
<property name="interfaceMappings">
|
||||
<map>
|
||||
<entry
|
||||
key="spring:service=batch,bean=jobLauncher"
|
||||
value="org.springframework.batch.execution.bootstrap.support.ExportedJobLauncher" />
|
||||
<entry key="spring:service=batch,bean=jobLoader"
|
||||
value="org.springframework.batch.sample.JobLoader" />
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="notificationPublisher"
|
||||
class="org.springframework.batch.sample.advice.JobExecutionNotificationPublisher" />
|
||||
|
||||
<bean id="logAdvice"
|
||||
class="org.springframework.batch.sample.advice.MethodExecutionLogAdvice" />
|
||||
|
||||
@@ -86,18 +49,4 @@
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<bean id="jobLauncher"
|
||||
class="org.springframework.batch.execution.launch.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
<property name="taskExecutor">
|
||||
<bean
|
||||
class="org.springframework.core.task.SimpleAsyncTaskExecutor" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="loader"
|
||||
class="org.springframework.batch.sample.DefaultJobLoader">
|
||||
<property name="registry" ref="jobConfigurationRegistry" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -122,12 +122,21 @@
|
||||
</bean>
|
||||
|
||||
<aop:config>
|
||||
<aop:aspect id="moduleLogging" ref="itemProcessorLogAdvice">
|
||||
|
||||
<aop:aspect id="moduleLogging" ref="logAdvice">
|
||||
<aop:after
|
||||
pointcut="execution( * org.springframework.batch.item.ItemWriter+.write(Object)) and args(item)"
|
||||
method="doStronglyTypedLogging" />
|
||||
|
||||
</aop:aspect>
|
||||
<aop:aspect ref="eventAdvice">
|
||||
<aop:before
|
||||
pointcut="execution( * org.springframework.batch..Step+.execute(..))"
|
||||
method="before" />
|
||||
<aop:after
|
||||
pointcut="execution( * org.springframework.batch..Step+.execute(..))"
|
||||
method="after" />
|
||||
<aop:after-throwing throwing="t"
|
||||
pointcut="execution( * org.springframework.batch..Step+.execute(..))"
|
||||
method="onError" />
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
|
||||
@@ -138,12 +138,10 @@
|
||||
<bean parent="customEditorConfigurer" />
|
||||
|
||||
<aop:config>
|
||||
<aop:aspect id="moduleLogging" ref="itemProcessorLogAdvice">
|
||||
|
||||
<aop:aspect id="moduleLogging" ref="logAdvice">
|
||||
<aop:after
|
||||
pointcut="execution( * org.springframework.batch.item.ItemWriter+.write(Object)) and args(item)"
|
||||
method="doStronglyTypedLogging" />
|
||||
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
|
||||
@@ -146,16 +146,28 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="itemProcessorLogAdvice"
|
||||
<bean id="logAdvice"
|
||||
class="org.springframework.batch.sample.advice.ProcessorLogAdvice" />
|
||||
|
||||
<bean id="eventAdvice"
|
||||
class="org.springframework.batch.sample.advice.MethodExecutionApplicationEventAdvice" />
|
||||
|
||||
<aop:config>
|
||||
<aop:aspect id="moduleLogging" ref="itemProcessorLogAdvice">
|
||||
|
||||
<aop:aspect ref="logAdvice">
|
||||
<aop:after
|
||||
pointcut="execution( * org.springframework.batch.item.ItemWriter+.write(Object)) and args(item)"
|
||||
method="doStronglyTypedLogging" />
|
||||
|
||||
pointcut="execution( * org.springframework.batch.sample..InfiniteLoopTasklet+.execute(..))"
|
||||
method="doBasicLogging" />
|
||||
</aop:aspect>
|
||||
<aop:aspect ref="eventAdvice">
|
||||
<aop:before
|
||||
pointcut="execution( * org.springframework.batch..Step+.execute(..))"
|
||||
method="before" />
|
||||
<aop:after
|
||||
pointcut="execution( * org.springframework.batch..Step+.execute(..))"
|
||||
method="after" />
|
||||
<aop:after-throwing throwing="t"
|
||||
pointcut="execution( * org.springframework.batch..Step+.execute(..))"
|
||||
method="onError" />
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TaskExecutorLauncher {
|
||||
// TaskExecutor. The adhocLoopJob has both, which is why it has to be
|
||||
// included in the paths above.
|
||||
final ApplicationContext parent = new ClassPathXmlApplicationContext(
|
||||
"simple-container-definition.xml");
|
||||
"adhoc-job-launcher-context.xml");
|
||||
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user