Announcement Announcement Module
Collapse
No announcement yet.
Spring 3.1 + Quartz 2.0 : repeatCount? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3.1 + Quartz 2.0 : repeatCount?

    Hi everybody,

    We upgraded our project on spring 3.1 and we use quartz for scheduling actions on application's starting (and other).
    In the previous version of spring (2.5), it was possible to set the number of repeating time of a task in "SimpleTriggerBean" by the property "repeatCount".
    But, in the 3.1 version of spring with quartz 2.0, this property has disappeared in "SimpleTriggerFactoryBean" and i don't find any workaround.

    In old version (2.5):
    Code:
    <bean id="jobRebuildHibernateSearchSimpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
    	    <property name="jobDetail" ref="jobRebuildHibernateSearchDetail" />
    	    <property name="startDelay" value="6000" />
    	    <property name="repeatInterval" value="999" />
    	    <property name="repeatCount" value="0" />
    	</bean>
    In new version (3.1) :
    Code:
    <bean id="jobRebuildHibernateSearchSimpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
    	    <property name="jobDetail" ref="jobRebuildHibernateSearchDetail" />
    	    <property name="startDelay" value="6000" />
    	    <property name="repeatInterval" value="999" />
    	</bean>
    Get tips ?

    Thanks in advance

  • #2
    Here's an workaround, but is not elegant:
    Code:
    	<bean id="exampleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
    		<property name="jobDetail" ref="jobDetail" />
    		<property name="startDelay" value="600" />
    		<property name="repeatInterval" value="1000" />
    	</bean>
    
    	<bean id="exampleTriggerModified" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    		<property name="targetObject">
    			<ref local="exampleTrigger" />
    		</property>
    		<property name="targetMethod">
    			<value>setRepeatCount</value>
    		</property>
    		<property name="arguments">
    			<list>
    				<value>3</value>
    			</list>
    		</property>
    	</bean>
    
    	<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    		<property name="targetObject" ref="exampleJobDetail" />
    		<property name="targetMethod" value="doIt" />
    	</bean>
    
    	<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
    		depends-on="exampleTriggerModified">
    		<property name="triggers">
    			<list>
    				<ref bean="exampleTrigger" />
    			</list>
    		</property>
    	</bean>
    
    	<bean id="exampleJobDetail" class="com.foo.ExampleJobDetail" />

    Comment


    • #3
      https://jira.springsource.org/browse/SPR-9521

      Comment

      Working...
      X