Results 1 to 4 of 4

Thread: Scheduler in Spring

  1. #1
    Join Date
    Sep 2004
    Location
    London
    Posts
    311

    Default Scheduler in Spring

    hi all,
    i have a webapplication that schedules persistent jobs using Quartz and Spring.
    In appplicationContext.xml i am currently defining a SchedulerFactoryBean and a JobDetailBean.
    <code>
    <bean id="springScheduler" class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
    <property name="applicationContextSchedulerContextKey">
    <value>applicationContext</value>
    </property>
    </bean>

    <bean name="budgetJob" class="org.springframework.scheduling.quartz.JobDe tailBean">
    <property name="jobClass">
    <value>com.myapp.scheduler.BudgetJob</value>
    </property>
    </bean>
    </code>

    In my application i want also to be able to stop/pause/resume tasks, and for that i need a reference to Quartz Scheduler. Can i get it from SchedulerFactoryBean? if so, how?

    thanx in advance and regards
    marco

  2. #2
    Join Date
    Sep 2004
    Posts
    127

    Default

    To the rest of your application, the SchedulerFactoryBean is the Scheduler (see the FactoryBean JavaDocs for details).

    So if your class has a property named myScheduler of type org.quartz.Scheduler, the following should be sufficient:

    Code:
    <bean id="springScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> 
        ...
    </bean>
    
    <bean name="myBean" class="org.example.MyBean"> 
        <property name="myScheduler"> 
            <ref local="springScheduler"/>
        </property> 
    </bean>
    At least that's how I understand it..

  3. #3
    Join Date
    Sep 2004
    Location
    London
    Posts
    311

    Default

    ok found answer.
    "org.springframework.scheduling.quartz.SchedulerFa ctoryBean" will return a org.quartz.StdScheduler , which is what i needed..

    thanx and regards
    marco

  4. #4
    Join Date
    Sep 2004
    Posts
    127

    Default

    Glad I could help for once :-)

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. Replies: 5
    Last Post: Aug 9th, 2008, 05:30 AM
  3. A Spring Class Loader?
    By azzoti in forum Architecture
    Replies: 8
    Last Post: May 7th, 2005, 04:02 AM
  4. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM
  5. Replies: 2
    Last Post: Jan 21st, 2005, 04:17 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
  •