I am using Quartz Scheduler (v2.2.1) in some Java WARs and I am having some trouble while recovering from database errors. The WARs are deployed in JBOSS AS 7.1.
In the initialization of the WAR, I start two schedulers: the first one configured with JobStoreTX as clustered (the WARs are deployed in a cluster) and the second one, configured with RAMJobStore in order to monitor some server specific settings.
The RAM Scheduler also includes a Job which monitors a table from a MySQL database. In case of error, it would be desirable to keep the Quartz jobs firing, but the fact is sometimes the Scheduler is frozen and these jobs are not fired.
For instance, I used the following method in my tests, with no luck re-instantianting the scheduler:
/**
* Resets all scheduled jobs.
*/
public void reset(final long currentTime) {
try {
final StdSchedulerFactory schedFactory = new StdSchedulerFactory();
schedFactory.initialize("quartz.properties");
Scheduler myScheduler = schedFactory.getScheduler();
if (myScheduler != null) {
myScheduler.clear();
myScheduler.shutdown(); --> HERE, THE THREAD IS LOCKED !!!
myScheduler = null;
}
myScheduler = schedFactory.getScheduler();
loadJobs(myScheduler);
myScheduler.start();
//myScheduler.startDelayed(10);
} catch (SchedulerException e) {
LOG.error("Scheduler error !!!");
}
}
Which is the proper method to restart a Quartz Scheduler?
Thanks in advance
UPDATE 1
As the Scheduler object seems to be the same...I modified the method, with no luck, re-instantiating the StdSchedulerFactory and the Scheduler before calling shutdown.
Could you provide any functional example?
Thanks