Results 1 to 4 of 4

Thread: startScheduler in SchedulerFactoryBean, usage?

  1. #1
    Join Date
    Aug 2004
    Posts
    6

    Default startScheduler in SchedulerFactoryBean, usage?

    I am looking for a way to start and stop the factory bean scheduler. I set autoStart to false so I can say when to go, and when to stop. The only issue I have hit, is how? I know I must be missing something. Does anyone have an example of this?

    Thanks!

  2. #2
    Join Date
    Aug 2004
    Posts
    6

    Default Got it

    After a lot of reading I found out my issue

    Due to the design of the QuartzBean I can not do waht I want to.

    That said, the QuartzBean really does not get you anything if you WANT to use the scheduler directly. So I just added the StdSchedulerFactory to spring with the <prop> options. And it works now.

  3. #3

    Default Need a help on scheduler....

    Hi

    I was trying for scheduling a job.
    I have done the following...

    <bean name="testJob" class="org.springframework.scheduling.quartz.JobDe tailBean">
    <property name="jobClass" value="test.TestJob" />
    <property name="jobDataAsMap">
    <map>
    <entry key="timeout" value="5" />
    </map>
    </property>
    </bean>
    <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronT riggerBean">
    <property name="jobDetail" ref="testJob" />
    <!-- run every morning at 6 AM -->
    <property name="cronExpression" value="0 0 6 * * ?" />
    </bean>

    <bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
    <property name="triggers">
    <list>
    <ref bean="cronTrigger" />
    </list>
    </property>
    </bean>

    package test;

    public class TestJob extends QuartzJobBean {

    private int timeout;

    /**
    * Setter called after the ExampleJob is instantiated
    * with the value from the JobDetailBean (5)
    */
    public void setTimeout(int timeout) {
    this.timeout = timeout;
    }

    protected void executeInternal(JobExecutionContext ctx) throws JobExecutionException {
    System.out.println(new Date());
    }
    }


    But my job is not starting........ can anyone help on this?
    even i changed this according to my system time...(This following shows everyday 6am)
    <property name="cronExpression" value="0 0 6 * * ?" />

    Thanks and advance...

  4. #4
    Join Date
    Dec 2008
    Posts
    7

    Default

    As you say, the job will start every day at 6. But it will end at 6:59 (according to the cron expression).

    Is this how you started your service the first time? And did you change this start time later? Do you store your job in a database?

    If all questions are answered with yes, then add this property:
    <property name="overwriteExistingJobs" value="true" />

    Hope this helps.

Similar Threads

  1. Error using Quartz integration SchedulerFactoryBean
    By dhalbrook in forum Container
    Replies: 9
    Last Post: Oct 11th, 2011, 09:58 AM
  2. Scheduler Instance From SchedulerFactoryBean
    By rbsmani in forum Container
    Replies: 4
    Last Post: Sep 24th, 2008, 10:37 AM
  3. sessionForm usage
    By lime in forum Web
    Replies: 1
    Last Post: Aug 4th, 2005, 05:35 PM
  4. Acegi Usage Scenario
    By Matador in forum Security
    Replies: 1
    Last Post: Mar 23rd, 2005, 05:12 PM
  5. Replies: 4
    Last Post: Oct 7th, 2004, 07:26 AM

Posting Permissions

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