public boolean removeAllJobs(List<JobKey> jobKeys) { boolean flag = false; try { flag = scheduler.deleteJobs(jobKeys); } catch (SchedulerException e) { logger.error("调度器批量删除JOB异常:" + e.getMessage()); } return flag; }
/** Delete all quartz scheduler jobs of the group <code>Dropbox</code>. */ private void cancelAllJobs() { try { Scheduler sched = StdSchedulerFactory.getDefaultScheduler(); Set<JobKey> jobKeys = sched.getJobKeys(jobGroupEquals(GCAL_SCHEDULER_GROUP)); if (jobKeys.size() > 0) { sched.deleteJobs(new ArrayList<JobKey>(jobKeys)); logger.debug( "Found {} Google Calendar Upload-Jobs to delete from DefaulScheduler (keys={})", jobKeys.size(), jobKeys); } } catch (SchedulerException e) { logger.warn("Couldn't remove Google Calendar Upload-Job: {}", e.getMessage()); } }