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

  • runtime scheduling

    hello all

    now i am making server component like workList Service.
    by the way i am wondering if i use quartz classes in spring framework,
    is it possible to make run time scheduling ? That's means register new scheduled task at runtime and modify or remove scheduled task.

    plz tell me it is possible or not. and if it si possible, give me tips how to make it.

    thanks in advance and sorry my poor english

  • #2
    Yes, you can.

    You just need to get a reference to the quartz scheduler itself.
    In your service class declare a
    Code:
    private Scheduler quartzScheduler.
    Inject the Quartz scheduler using Spring IoC according to Spring documentation.

    Once you get the scheduler reference, you have access to the full blown Quartz API.

    Just as an example, you can
    Code:
    scheduler.start()
    scheduler.shutdown(true)
    to add job and a trigger at the same time
    Code:
     JobDetail jobDetail = createJobDetail(job); //write your own impl
    
     Trigger trigger = createTriggerFromJob(job); //write your own impl
    
            try {
                scheduler.scheduleJob(jobDetail, trigger);
    
            }
            catch (SchedulerException ex) {
                logger.error(ex);
            }
    If you need scheduled jobs to "survive" server resets or "reboots", use Quartz persistance mechanism.

    Cheers,
    Gustavo.

    Comment


    • #3
      thx

      Thanks a lot...
      I will find out... :shock:

      Comment

      Working...
      X