/** * Triggers a Job interrupt on all Jobs matching the given Job Name * * @param jobName The job name */ public static void stopJob(String jobName) { try { List<JobExecutionContext> currentlyExecutingJobs = getScheduler().getCurrentlyExecutingJobs(); for (JobExecutionContext jobExecutionContext : currentlyExecutingJobs) { String currentlyExecutingJobName = jobExecutionContext.getJobDetail().getName(); if (currentlyExecutingJobName.equals(jobName)) { logger.debug("Matching Job found. Now Stopping!"); if (jobExecutionContext.getJobInstance() instanceof Job) { ((Job) jobExecutionContext.getJobInstance()).interrupt(); } else { logger.warn("CANNOT STOP NON-INTERRUPTABLE JOB!!!"); } } else { logger.debug("Non-matching Job found. Not Stopping!"); } } } catch (SchedulerException e) { logger.error("ERROR STOPPING JOB!!!", e); } }
/** * Triggers a Job interrupt on all Jobs matching the given Job Name. The Job termination mechanism works by setting a flag that the Job should be * terminated, but it is up to the logic in the Job to decide at what point termination should occur. Therefore, in any long-running job that you * anticipate the need to terminate, put the method call checkTerminated() at an appropriate location. * * @param jobName The job name */ public static void stopJob(String jobName) throws SundialSchedulerException { try { List<JobExecutionContext> currentlyExecutingJobs = getScheduler().getCurrentlyExecutingJobs(); for (JobExecutionContext jobExecutionContext : currentlyExecutingJobs) { String currentlyExecutingJobName = jobExecutionContext.getJobDetail().getName(); if (currentlyExecutingJobName.equals(jobName)) { logger.debug("Matching Job found. Now Stopping!"); if (jobExecutionContext.getJobInstance() instanceof Job) { ((Job) jobExecutionContext.getJobInstance()).interrupt(); } else { logger.warn("CANNOT STOP NON-INTERRUPTABLE JOB!!!"); } } else { logger.debug("Non-matching Job found. Not Stopping!"); } } } catch (SchedulerException e) { throw new SundialSchedulerException("ERROR STOPPING JOB!!!", e); } }
String currentlyExecutingJobName = jobExecutionContext.getJobDetail().getName(); if (currentlyExecutingJobName.equals(jobName)) { if (jobExecutionContext.getJobInstance() instanceof Job) { JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap(); String value = jobDataMap.getString(key); if (value != null & value.equalsIgnoreCase(pValue)) { ((Job) jobExecutionContext.getJobInstance()).interrupt();
/** * Triggers a Job interrupt on all Jobs matching the given Job Name. The Job termination mechanism * works by setting a flag that the Job should be terminated, but it is up to the logic in the Job * to decide at what point termination should occur. Therefore, in any long-running job that you * anticipate the need to terminate, put the method call checkTerminated() at an appropriate * location. * * @param jobName The job name */ public static void stopJob(String jobName) throws SundialSchedulerException { try { List<JobExecutionContext> currentlyExecutingJobs = getScheduler().getCurrentlyExecutingJobs(); for (JobExecutionContext jobExecutionContext : currentlyExecutingJobs) { String currentlyExecutingJobName = jobExecutionContext.getJobDetail().getName(); if (currentlyExecutingJobName.equals(jobName)) { logger.debug("Matching Job found. Now Stopping!"); if (jobExecutionContext.getJobInstance() instanceof Job) { ((Job) jobExecutionContext.getJobInstance()).interrupt(); } else { logger.warn("CANNOT STOP NON-INTERRUPTABLE JOB!!!"); } } else { logger.debug("Non-matching Job found. Not Stopping!"); } } } catch (SchedulerException e) { throw new SundialSchedulerException("ERROR STOPPING JOB!!!", e); } }
String currentlyExecutingJobName = jobExecutionContext.getJobDetail().getName(); if (currentlyExecutingJobName.equals(jobName)) { if (jobExecutionContext.getJobInstance() instanceof Job) { JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap(); String value = jobDataMap.getString(key); if (value != null & value.equalsIgnoreCase(pValue)) { ((Job) jobExecutionContext.getJobInstance()).interrupt();
String currentlyExecutingJobName = jobExecutionContext.getJobDetail().getName(); if (currentlyExecutingJobName.equals(jobName)) { if (jobExecutionContext.getJobInstance() instanceof Job) { JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap(); String value = jobDataMap.getString(key); if (value != null & value.equalsIgnoreCase(pValue)) { ((Job) jobExecutionContext.getJobInstance()).interrupt();
List<JobExecutionContext> jobs = getCurrentlyExecutingJobs(); for (JobExecutionContext job : jobs) { if (job.getJobInstance() instanceof InterruptableJob) { try { ((InterruptableJob) job.getJobInstance()).interrupt(); } catch (Throwable e) {
List<JobExecutionContext> jobs = getCurrentlyExecutingJobs(); for (JobExecutionContext job : jobs) { if (job.getJobInstance() instanceof InterruptableJob) { try { ((InterruptableJob) job.getJobInstance()).interrupt(); } catch (Throwable e) {
List<JobExecutionContext> jobs = getCurrentlyExecutingJobs(); for (JobExecutionContext job : jobs) { if (job.getJobInstance() instanceof InterruptableJob) { try { ((InterruptableJob) job.getJobInstance()).interrupt(); } catch (Throwable e) {