I run a cron job using the Scheduler plugin to keep a constant open connection (basically just sends an SQL query every 30 minutes). Generally speaking it works OK (klugey work around to keep a connection to an Oracle datasource that IS NOT shut down by the Oracle server - seems to be shut down by the network here somehow). Every once and a while though something does shut down the connection regardless. At that point I try to go and reset the cron job and I get the message :
java.lang.RuntimeException: Couldn't schedule job cronJob1 error: The Scheduler has been shutdown. (cronJob1, line 11)
There doesn’t seem to be anything in the Method editor for restarting the Scheduler. Noseying around on the web I came across this: http://quartz.sourceforge.net/firstTutorial.html#using
which gives this as possible code:
schedFact = new org.quartz.impl.StdSchedulerFactory();
sched = schedFact.getScheduler();
sched.start();
This doesn’t work directly within a method however. Can anyone point me how to ‘Start’ the Scheduler?
Thanks for the reply. Actually my problem is that at times the Scheduler itself shuts down. The ‘cronjobs’ run ok (in my case just simple queries to the respective databases). But for some reason the Scheduler will sometimes stop and then the only way to get it going is to restart the server (or developer if I’m working on that). So I’m trying to see how one ‘restarts’ the scheduler without having to do that.
I have had experiences with the scheduler (running in a batch process) stopping after a method caused an error. Odd thing was that it didn’t log anything (other than in a trace log).
Only option to fix it was to restart the batch process.
Maybe this is some safety feature so that buggy scheduled jobs won’t stay running.
Anyway, I would suggest you check out if the method got an error and see if you can catch or fix it.