Announcement Announcement Module
No announcement yet.
autoStartup dilemma Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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:

      	<bean id="myObject" class="com.yyy.myObject">
    		<property name="xxx" value="yyy" />
    	<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 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 class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    		<property name="triggers">
    				<ref bean="myObjectJobCronTrigger" />
    		<property name="autoStartup" value="true" />

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


    • #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