I am using Quartz 2.0.1 scheduler from StdSchedulerFactory.
I am catching SchedulerException in my code.
Should I shutdown the scheduler in a finally block:
} finally {
scheduler.shutdown();
}
or should I do the shutdown in the try block?
The shutdown method can throw SchedulerException, so it seems the shutdown should not be in the finally block.
You don’t have to do it in the finally block in any case because if the scheduler is started successfully it won’t throw the
SchedulerExceptionand hence if you are reaching the catch block ofSchedulerExceptionthat means the scheduler was never started. So, you should not shutdown a scheduler that is never started.Here is a sample program from the project homepage.
Also, from the above link,