Announcement Announcement Module
No announcement yet.
How to enable DisallowConcurrentExecution of Quartz2.x in Spring3.2.x Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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 name="targetMethod">
    <property name="concurrent">

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

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

    The detectResource is started with:
    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?