RESOLVED - issue BATCH-312: Fix JMX demo now that JobIdentifier has been replaced with JobParameters

http://jira.springframework.org/browse/BATCH-312

Implemented ExportedJobLauncher and exposed in JMX
This commit is contained in:
dsyer
2008-01-24 12:49:36 +00:00
parent 58efcd47ef
commit d8da44cc92
6 changed files with 494 additions and 150 deletions

View File

@@ -8,6 +8,8 @@
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;sourceLookupDirector&gt;&#13;&#10;&lt;sourceContainers duplicates=&quot;false&quot;&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;spring-batch-core&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;spring-batch-execution&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;spring-batch-infrastructure&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;spring-batch-integration&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;spring-batch-samples&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;default/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#13;&#10;&lt;/sourceContainers&gt;&#13;&#10;&lt;/sourceLookupDirector&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.springframework.batch.sample.TaskExecutorLauncher"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="spring-batch-samples"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dcom.sun.management.jmxremote"/>

View File

@@ -1,153 +1,155 @@
<?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"
<?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">
<!-- The tasklet used in this job will run in an infinite loop. This is useful for testing graceful shutdown from
multiple environments. -->
<bean parent="stepScope" />
<bean parent="jobConfigurationRegistryBeanPostProcessor" />
<bean id="loopJob" parent="simpleJob">
<property name="steps">
<bean id="step1" parent="simpleStep">
<property name="tasklet">
<bean id="module"
class="org.springframework.batch.sample.tasklet.InfiniteLoopTasklet"
scope="step">
<aop:scoped-proxy />
</bean>
</property>
<property name="commitInterval" value="2" />
</bean>
</property>
</bean>
<bean id="notifyingStepExecutor" parent="stepExecutor"
scope="prototype">
<property name="stepOperations">
<bean
class="org.springframework.batch.repeat.support.RepeatTemplate">
<property name="interceptor">
<bean
class="org.springframework.batch.repeat.interceptor.ApplicationEventPublisherRepeatInterceptor" />
</property>
</bean>
</property>
</bean>
<bean class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="spring:service=batch,bean=jobLauncher">
<bean
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="jobLauncher" />
<property name="interfaces">
<list>
<value>
org.springframework.batch.execution.bootstrap.support.ExportedJobLauncher
</value>
</list>
</property>
<property name="interceptorNames"
value="convertingMethodInterceptor" />
</bean>
</entry>
<entry
key="spring:service=batch,bean=notificationPublisher"
value-ref="notificationPublisher" />
<entry
key="spring:service=batch,bean=configurationLoader">
<bean
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="loader" />
<property name="interfaces">
<list>
<value>
org.springframework.batch.sample.ExportedJobLoader
</value>
</list>
</property>
<property name="interceptorNames"
value="convertingMethodInterceptor" />
</bean>
</entry>
</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.execution.bootstrap.JobExecutionNotificationPublisher" />
<bean id="convertingMethodInterceptor"
class="org.springframework.batch.execution.bootstrap.support.TypeConverterMethodInterceptor">
<!-- The tasklet used in this job will run in an infinite loop. This is useful for testing graceful shutdown from
multiple environments. -->
<bean parent="stepScope" />
<bean parent="jobConfigurationRegistryBeanPostProcessor" />
<bean id="loopJob" parent="simpleJob">
<property name="steps">
<bean id="step1" parent="simpleStep">
<property name="tasklet">
<bean id="module"
class="org.springframework.batch.sample.tasklet.InfiniteLoopTasklet"
scope="step">
<aop:scoped-proxy />
</bean>
</property>
<property name="commitInterval" value="2" />
</bean>
</property>
</bean>
<bean id="notifyingStepExecutor" parent="stepExecutor"
scope="prototype">
<property name="stepOperations">
<bean
class="org.springframework.batch.repeat.support.RepeatTemplate">
<property name="interceptor">
<bean
class="org.springframework.batch.repeat.interceptor.ApplicationEventPublisherRepeatInterceptor" />
</property>
</bean>
</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">
<bean
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="loader" />
<property name="interfaces">
<list>
<value>
org.springframework.batch.sample.ExportedJobLoader
</value>
</list>
</property>
<property name="interceptorNames"
value="convertingMethodInterceptor" />
</bean>
</entry>
</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.execution.bootstrap.JobExecutionNotificationPublisher" />
<bean id="convertingMethodInterceptor"
class="org.springframework.batch.execution.bootstrap.support.TypeConverterMethodInterceptor">
<property name="convertException" value="true" />
<property name="customEditors">
<map>
<entry key="org.springframework.batch.core.domain.JobIdentifier">
<bean class="org.springframework.batch.execution.bootstrap.support.JobParametersPropertyEditor"/>
<entry
key="org.springframework.batch.core.domain.JobParameters">
<bean
class="org.springframework.batch.execution.bootstrap.support.JobParametersPropertyEditor" />
</entry>
<entry
key="org.springframework.batch.core.domain.Job">
<bean
class="org.springframework.batch.execution.bootstrap.support.JobPropertyEditor">
<property name="jobLocator"
ref="jobConfigurationRegistry" />
</bean>
</entry>
</map>
</property>
</bean>
<bean id="logAdvice"
class="org.springframework.batch.sample.advice.MethodExecutionLogAdvice" />
<aop:config>
<aop:aspect ref="logAdvice">
<aop:after
pointcut="execution( * org.springframework.batch.sample..InfiniteLoopTasklet+.execute(..))"
method="doBasicLogging" />
</aop:aspect>
</aop:config>
<bean id="jobLauncher"
class="org.springframework.batch.execution.launch.SimpleJobLauncher">
<property name="jobRepository" ref="simpleJobRepository" />
<property name="jobExecutor">
<bean parent="jobExecutor">
<property name="stepExecutorFactory">
<bean
class="org.springframework.batch.execution.step.PrototypeBeanStepExecutorFactory">
<property name="stepExecutorName"
value="notifyingStepExecutor" />
</bean>
</property>
</bean>
</property>
<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>
</property>
</bean>
<bean id="logAdvice"
class="org.springframework.batch.sample.advice.MethodExecutionLogAdvice" />
<aop:config>
<aop:aspect ref="logAdvice">
<aop:after
pointcut="execution( * org.springframework.batch.sample..InfiniteLoopTasklet+.execute(..))"
method="doBasicLogging" />
</aop:aspect>
</aop:config>
<bean id="jobLauncher"
class="org.springframework.batch.execution.launch.SimpleJobLauncher">
<property name="jobRepository" ref="simpleJobRepository" />
<property name="jobExecutor">
<bean parent="jobExecutor">
<property name="stepExecutorFactory">
<bean
class="org.springframework.batch.execution.step.PrototypeBeanStepExecutorFactory">
<property name="stepExecutorName"
value="notifyingStepExecutor" />
</bean>
</property>
</bean>
</property>
<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>