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

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

    Comment


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

      thanx and regards
      marco

      Comment


      • #4
        Glad I could help for once :-)

        Comment

        Working...
        X