Announcement Announcement Module
Collapse
No announcement yet.
SchedulerFactoryBean autoStartup property not working Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SchedulerFactoryBean autoStartup property not working

    When I load up my application, I do not want my Quartz scheduling apps to start automatically. There seems to be a property in Spring to do such a thing.

    SchedulerFactoryBean
    setAutoStartup(boolean autoStartup)
    Set whether to automatically start the scheduler after initialization.

    However when I set this property to false, my scheduling app still runs automatically.

    Here is what is in my application context:
    <bean class="org.springframework.scheduling.quartz.Sched ulerFac toryBean">
    <property name="triggers">
    <ref bean="cronTrigger"/>
    </property>

    <property name="autoStartup">
    <value>false</value>
    </property>

    </bean>

    Any help on why this may be occurring would be appreciated.

    I am running Spring 1.2.6/ Quartz 1.5.2
    Thanks!
    Spirit.J

  • #2
    When the SchedulerFactoryBean starts up, it retrieves a Schedule from the SchedulerFactory using the "scheduleName" attribute. If this is not set in the configuration, it will not get the correct scheduler.

    So, just add the "schedulerName" property ...


    <property name="schedulerName">
    <value>cronScheduler</value>
    </property>

    Comment


    • #3
      Can someone tell me whether this is good advice or not. I'm struggling with the same issue and I can't see how this advice helps.

      Comment


      • #4
        Are you saying that autoStartup doesn't work? What actually happens?

        Comment


        • #5
          I'm actually in exactly the situation that the original poster was in. i.e. that I want to define a schedule but disable it until I programmatically tell it to start.

          spiritj said:
          When I load up my application, I do not want my Quartz scheduling apps to start automatically.
          The answer from jlong just didn't seem to answer the question.

          I've added the following to my configuration:

          Code:
          <property name="schedulerName">
          <value>cronScheduler</value>
          </property>
          But that doesn't stop my quartz jobs from firing.

          For the record here's what I need to do:

          I have an intra-day job which runs every 5 mins, this needs to be disabled at certain times when either the business don't want it to run, or when our end-of-day batch is running. It also should not start running when the application server comes up. It must wait until another process tells it to start doing it's thing. (This job is part of a huge suite of batches, all written in different languages on different machines, all coordinated using Autosys - which is like an enterprise wide distributed cron)

          Comment


          • #6
            I've set up my scheduler like this:

            Code:
                <bean id="schedulerFactoryBeanShouldRunOnStartup" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
                    <property name="triggers">
                        <list>
                            <ref bean="completedExceptionMonitorTrigger"/>
                            <ref bean="runningExceptionMonitorTrigger"/>
                            <ref bean="completedGarbagedMonitorTrigger"/>
                            <ref bean="eodCompletedMonitorTrigger"/>
                        </list>
                    </property>
                </bean>
                
                <bean id="schedulerFactoryBeanShouldNOTRunOnStartup" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
                    <property name="autoStartup" value="false"/>
                    <property name="schedulerName" value="cronScheduler"/>
                    <property name="triggers">
                        <list>
                            <ref bean="eodRunningMonitorTrigger"/>
                            <ref bean="intradayInfoRunMonitorTrigger"/>
                            <ref bean="intradaySatWarningRunMonitorTrigger"/>
                            <ref bean="intradaySunWarningRunMonitorTrigger"/>
                        </list>
                    </property>
                </bean>
            But the second scheduler, schedulerFactoryBeanShouldNOTRunOnStartup, still starts when the application server is started.

            Comment


            • #7
              At some point after startup an external job calls an EJB and that will get a handle to schedulerFactoryBeanShouldNOTRunOnStartup from Spring and tell it to start using the SchedulerFactoryBean.start() method.

              Comment


              • #8
                Further testing appears to indicate that the autoStartup property is now working. I must have had it configured incorrectly in the first instance.

                Thanks for putting up with my lengthy posts.

                Comment


                • #9
                  Originally posted by Flynn View Post
                  Further testing appears to indicate that the autoStartup property is now working. I must have had it configured incorrectly in the first instance.
                  I didn't even get chance to respond . I was kind of surprised in the first instance that this didn't work, glad to know it does.

                  Originally posted by Flynn View Post
                  Thanks for putting up with my lengthy posts.
                  Not a problem .

                  Comment


                  • #10
                    Originally posted by jlong View Post
                    When the SchedulerFactoryBean starts up, it retrieves a Schedule from the SchedulerFactory using the "scheduleName" attribute. If this is not set in the configuration, it will not get the correct scheduler.

                    So, just add the "schedulerName" property ...


                    <property name="schedulerName">
                    <value>cronScheduler</value>
                    </property>
                    For me it worked just fine. Thanks

                    Comment

                    Working...
                    X