Announcement Announcement Module
Collapse
No announcement yet.
SchedulerFactoryBean loading on startup though lazy-init=true Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SchedulerFactoryBean loading on startup though lazy-init=true

    I am using Spring SchedulerFactoryBean to created scheuler instance. I don not want to create an instance of Scheduler while loading Spring Context of weblogic start up. But see the following logs during weblogic start up even though I am using lazy-init="true". Could anyone please explain the behaviour or am I doing something wrong.

    <bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.Sched ulerFactoryBean" lazy-init="true">

    <2010-03-16 11:44:53,453> <> <INFO > <> <> <> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <org.quartz.core.SchedulerSignalerImpl> - <Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl>
    <2010-03-16 11:44:53,453> <> <INFO > <> <> <> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <org.quartz.core.QuartzScheduler> - <Quartz Scheduler v.1.6.5 created.>
    <2010-03-16 11:44:53,859> <> <INFO > <> <> <> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <org.springframework.scheduling.quartz.LocalDataSo urceJobStore> - <Using db table-based data access locking (synchronization).>
    <2010-03-16 11:44:53,906> <> <INFO > <> <> <> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <org.springframework.scheduling.quartz.LocalDataSo urceJobStore> - <JobStoreCMT initialized.>
    <2010-03-16 11:44:53,921> <> <INFO > <> <> <> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <org.quartz.impl.StdSchedulerFactory> - <Quartz scheduler 'dev-scheduler' initialized from an externally provided properties instance.>
    <2010-03-16 11:44:53,921> <> <INFO > <> <> <> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <org.quartz.impl.StdSchedulerFactory> - <Quartz scheduler version: 1.6.5>
    <2010-03-16 11:44:54,187> <> <INFO > <> <> <> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <org.quartz.core.QuartzScheduler> - <JobFactory set to: org.springframework.scheduling.quartz.AdaptableJob Factory@11f4720>

  • #2
    Look at the javadocs of the SchedulerFactoryBean it has a property like autostart or something. set that to false if you dont want the scheduler to get started on context load/refresh.

    However that of course means that you'll have to start it programatically in your code

    Comment


    • #3
      Thanks for the reply.

      I am already doing that. Have set the autostart property to false. Still this is happening.

      Other point is if lazy-int=true, the bean instance should not be created first. Considering autostart is secondary. Does this makes sense?

      Comment


      • #4
        From the logs that you posted it looks like Spring only created the SchedulerFactoryBean created, it didn't actually start it. Do you see logs that say the scheduler has been started?

        I think I would agree on your point about the lazy init, but first- are you sure no other non lazy-init bean has the dependency on the Scheduler?

        Comment


        • #5
          Only other bean, which is using "schedulerFactoryBean" is below. Even this one is defined lazy-init="true".


          <bean id="schedulerService" class="com.intralinks.scheduler.QuartzSchedulerSer vice"
          lazy-init="true">
          <property name="scheduler" ref="schedulerFactoryBean" />
          </bean>

          I have @Required on the setter method.

          @Required
          public void setScheduler(Scheduler scheduler)
          {
          this.scheduler = scheduler;
          }

          Could this be causing the issue.

          Comment


          • #6
            Pls use the [code] tag.

            Logically this shouldn't since this bean is also marked as Lazy-init. What about dependency on this bean... basically you need to follow all dependencies direct or transitive.

            If you have very complex dependencies - a relatively easier way would be to follow the stack trace that spring prints (if you have the logging on for Spring component). It shows the chain of dependencies in the exception if a dependent bean initialization fails (make the initialization of the scheduler bean fail somehow by extending the SchedulerFactory bean and throwing an Exception in the constructor).
            Last edited by amit.kapps; Mar 16th, 2010, 06:08 PM. Reason: Added details

            Comment

            Working...
            X