Question

I'm thinking of building spring quartz into my spring mvc web application. I have a few questions about it that I could not properly find an answer.

  1. If I want to use cron triggers for spring quartz does quartz execute the job using java system time or the operating system time?
  2. I am planning to have a properties file to hold all of my cron triggers. If someone goes and changes a cron trigger for an ad-hoc execution of a job will quartz automatically pick up the changes in the file? Or is there a way for me to tell quartz how to do this if it is not default behavior.
  3. I have been reading about spring batch admin console recently. Sounds like a nice gui tool to reschedule jobs. Can it be used to make ad-hoc changes to crontab triggers? Or is there another gui tool I could use to manage the job triggers?

thanks in advance

Was it helpful?

Solution

Quartz

  1. Quartz uses custom thread scheduler (org.quartz.core.QuartzScheduler) which use java system time. It can integrate commonj interface to be JEE (WAS and Weblogic) interoperable.
  2. Reload configuration: read Quartz: How to reload jobs and triggers with org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin?
  3. Spring batch admin console is for spring batch and is bale to monitor batches activity

Reload configuration Using API

Generally speaking you can use quartz API programmatically (I use them):

    JobDetail job = new JobDetail();
    job.setName("myJob");
    job.setJobClass(MyJob.class);

    CronTrigger trigger = new CronTrigger();
    trigger.setName("myTriggerName");
    trigger.setCronExpression("0/30 * * * * ?");


    Scheduler scheduler = new StdSchedulerFactory().getScheduler();
    scheduler.start();
    scheduler.scheduleJob(job, trigger);

these APIs provide you fine control.

Reload configuration JMX way

You can control the Qurtz scheduler through RemoteMBeanScheduler:

An implementation of the Scheduler interface that remotely proxies all method calls to the equivalent call on a given QuartzScheduler instance, via JMX.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top