Results 1 to 3 of 3

Thread: autoStartup dilemma

  1. #1

    Default 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. #2
    Join Date
    Jun 2005
    Posts
    4,241

    Default

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

  3. #3

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •