Announcement Announcement Module
Collapse
No announcement yet.
programatical creation of SchedluerFactoryBean bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • jlukar
    started a topic programatical creation of SchedluerFactoryBean bean

    programatical creation of SchedluerFactoryBean bean

    So I'd like to use this scheduler bean to run jobs at runtime.

    I create the bean as such and set its triggers and listeners.
    When I do a start() nothing happens. I tried doing a getObject() and casting to StdSchedluer and then call start() but it throws a NPE.

    schedulerFactory = new SchedulerFactoryBean();
    schedulerFactory.setTriggers( triggers );
    schedulerFactory.setSchedulerListeners( listener );
    schedulerFactory.start();

    I ensure triggers and listeners are in existance before setting them on the factory bean.

    What am I doing wrong ?

    thanks much.

  • jlukar
    replied
    It worked. Thanks you very much.

    Leave a comment:


  • Mike Bingham
    replied
    If you're using the SchedulerFactoryBean programmatically, you will need to invoke the afterPropertiesSet() method to create the Scheduler instance and start the scheduler (you can call setAutoStartup(false) if you don't want the scheduler to start automatically). You can then call getObject() to get the Scheduler instance.

    Leave a comment:


  • jlukar
    replied
    Also, please note that if I leave the factory bean setup in the config xml file and instead try to get the schedluer as such from the factory:



    Scheduler scheduler = (Scheduler) ctx.getBean( "scheduler" );
    try {
    scheduler.start();
    } catch (SchedulerException e) {
    e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }



    this results in my jobDetail being called multiple times, depending on the number of times I execute the above code.

    is there some sort of scheduler reset() function ? nothing shows up in the API for this.

    Help!!

    Leave a comment:

Working...
X