In my app i'm using quartz to schedule some jobs to run in my Java application on Glassfish. Sometimes when i'm redeploying my application i'm forgetting to turn off my scheduler and it's impossible to stop them after new version of app has been deployed. So, the question is how does one can stop/kill quartz's threads after application has been un-deployed.
Here is my code to add job:
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched sched = sf.getScheduler();
// 1: EMS2ELC JOB /////////////
String EMS2ELCScheduleEx = "0 30 0 * * ?";
job = new JobDetail("EMS2ELCJob", "WebServicesGroup", EMS2ELCJob.class);
trigger = new CronTrigger("EMSTrigger", "WebServicesGroup", "EMS2ELCJob", "WebServicesGroup", EMS2ELCScheduleEx, TimeZone.getTimeZone("America/Los_Angeles"));
sched.addJob(job, true);
ft = sched.scheduleJob(trigger);
log.info("SchedulerController: " + job.getFullName() + " has been scheduled to run at: " + ft + " and repeat based on expression: " + trigger.getCronExpression());