Announcement Announcement Module
Collapse
No announcement yet.
How to enable DisallowConcurrentExecution of Quartz2.x in Spring3.2.x Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to enable DisallowConcurrentExecution of Quartz2.x in Spring3.2.x

    As we know that Spring3.1 supports Quartz2.x, and to use CronTriggerFactoryBean instead of CronTriggerBean. It works, but not well. Because in my app, I want to use @DisallowConcurrentExecution of Quartz2.x to replace the StatefulJob, and it's OK when I run it without Spring.
    In Spring3.2.x, I configured the beans as the following lines:
    <!--1 Job -->
    <bean id="detectResource" class="....ResourceManager" />

    <!--2 JobDetailFactory -->
    <bean id="detectJobDetail"
    class="org.springframework.scheduling.quartz.Metho dInvokingJobDetailFactoryBean">
    <property name="targetObject">
    <ref bean="detectResource" />
    </property>
    <property name="targetMethod">
    <value>execute</value>
    </property>
    <property name="concurrent">
    <value>false</value>
    </property>
    </bean>

    <!--3 CronTabFactory -->
    <bean id="detectCronTrigger" class="org.springframework.scheduling.quartz.CronT riggerFactoryBean">
    <property name="jobDetail">
    <ref bean="detectJobDetail" />
    </property>
    <property name="cronExpression">
    <value>0/1 * * * * ?</value>
    </property>
    </bean>

    <!--4 SchedulerFactory -->
    <bean id="schedulerFactory" class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
    <property name="triggers">
    <list>
    <ref bean="detectCronTrigger" />
    </list>
    </property>
    </bean>


    The detectResource is started with:
    @org.quartz.PersistJobDataAfterExecution
    @org.quartz.DisallowConcurrentExecution
    @Component
    public class ResourceManager{


    Simple to say that detectResource can work without Spring, but in Spring, if I remove the concurrent property, the job ResourceManager will be invoked concurrently. It seems the class MethodInvokingJobDetailFactoryBean doesn't support the new implementation of Quartz2. But why not to use the concurrent property is due to performance concern for Stateful job.
    Am I right? And how to solve this issue?
    Thanks!
Working...
X