Announcement Announcement Module
Collapse
No announcement yet.
autoStartup dilemma Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • autoStartup dilemma

    Hi, I'm new to spring and I'm facing the following problem.
    I'm using quartz to kick of a job every morning. However I would like to kick off the job every time I restart my jboss too (I thought the autoStartup property would do just that). This would be easily done using a SimpleTriggerBean, however for some other reasons I'd prefer to use the cron.

    This is my code:

    Code:
      	<bean id="myObject" class="com.yyy.myObject">
    		<property name="xxx" value="yyy" />
    	</bean>
    
    	<bean id="myObjectJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    		<property name="targetObject" ref="myObject" />
    		<property name="targetMethod" value="doSomething" />
    		<property name="concurrent" value="false"/>
    	</bean>
    
    	<bean id="myObjectJobCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    		<property name="jobDetail" ref="myObjectJob" />
    		 <!-- run every morning at 3.41  AM --> 
    		<property name="cronExpression" value="0 41 3 * * ?" />
    	</bean>
    
    	<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    		<property name="triggers">
    			<list>
    				<ref bean="myObjectJobCronTrigger" />
    			</list>
    		</property>
    		<property name="autoStartup" value="true" />
    	</bean>
    thanks

  • #2
    I think SimpleTriggerBean is the obvious solution. What makes you reluctant to use it?

    Comment


    • #3
      Thanks David

      Well, the thing is that I would like the job to run at a precise time.
      That way it won't interfere with :
      -other jobs kicked by other applications
      -peak hours.

      I can't simply relay on say 24h after the server was started

      Comment

      Working...
      X