org.quartz.UnableToInterruptJobException Java Examples
The following examples show how to use
org.quartz.UnableToInterruptJobException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JobExecutionContextWrapperBean.java From sakai with Educational Community License v2.0 | 6 votes |
public String processActionKill() { if (getIsKillable()) { InterruptableJob job = (InterruptableJob)jec.getJobInstance(); try { job.interrupt(); } catch (UnableToInterruptJobException e) { log.error(e.getMessage(), e); } FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, parentTool.rb.getFormattedMessage("kill_message", new String[] {jec.getJobDetail().getKey().getName()}), null)); } return "runningJobs"; }
Example #2
Source File: SchedulerServiceImpl.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
@Override public void interruptJob(String jobName) { List<JobExecutionContext> runningJobs = getRunningJobs(); for (JobExecutionContext jobCtx : runningJobs) { if (jobName.equals(jobCtx.getJobDetail().getName())) { // if so... try { ((Job) jobCtx.getJobInstance()).interrupt(); } catch (UnableToInterruptJobException ex) { LOG.warn("Unable to perform job interrupt", ex); } break; } } }
Example #3
Source File: JobScheduler.java From incubator-gobblin with Apache License 2.0 | 6 votes |
@Override protected void shutDown() throws Exception { LOG.info("Stopping the job scheduler"); closer.close(); cancelRequested = true; List<JobExecutionContext> currentExecutions = this.scheduler.getScheduler().getCurrentlyExecutingJobs(); for (JobExecutionContext jobExecutionContext : currentExecutions) { try { this.scheduler.getScheduler().interrupt(jobExecutionContext.getFireInstanceId()); } catch (UnableToInterruptJobException e) { LOG.error("Failed to cancel job " + jobExecutionContext.getJobDetail().getKey(), e); } } ExecutorsUtils.shutdownExecutorService(this.jobExecutor, Optional.of(LOG)); }
Example #4
Source File: JobExecutionContextWrapperBean.java From sakai with Educational Community License v2.0 | 6 votes |
public String processActionKill() { if (getIsKillable()) { InterruptableJob job = (InterruptableJob)jec.getJobInstance(); try { job.interrupt(); } catch (UnableToInterruptJobException e) { log.error(e.getMessage(), e); } FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, parentTool.rb.getFormattedMessage("kill_message", new String[] {jec.getJobDetail().getKey().getName()}), null)); } return "runningJobs"; }
Example #5
Source File: QuartzScheduler.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Interrupt the identified InterruptableJob executing in this Scheduler instance. * * <p> * This method is not cluster aware. That is, it will only interrupt * instances of the identified InterruptableJob currently executing in this * Scheduler instance, not across the entire cluster. * </p> * * @see org.quartz.core.RemotableQuartzScheduler#interrupt(JobKey) */ public boolean interrupt(String fireInstanceId) throws UnableToInterruptJobException { List<JobExecutionContext> jobs = getCurrentlyExecutingJobs(); Job job = null; for(JobExecutionContext jec : jobs) { if (jec.getFireInstanceId().equals(fireInstanceId)) { job = jec.getJobInstance(); if (job instanceof InterruptableJob) { ((InterruptableJob)job).interrupt(); return true; } else { throw new UnableToInterruptJobException( "Job " + jec.getJobDetail().getKey() + " can not be interrupted, since it does not implement " + InterruptableJob.class.getName()); } } } return false; }
Example #6
Source File: QuartzTaskJob.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Override public void interrupt() throws UnableToInterruptJobException { if (task instanceof Cancelable && !((Cancelable) task).isCanceled()) { ((Cancelable) task).cancel(); eventManager.post(new TaskEventCanceled(taskInfo)); } else if (task != null) { log.info("Task not cancelable: {}", task.taskConfiguration().getTaskLogName()); throw new UnableToInterruptJobException("Task not cancelable: " + task); } // else premature/too-late; ignore }
Example #7
Source File: ScheduleService.java From elasticsearch-quartz with Apache License 2.0 | 5 votes |
public boolean interrupt(final String fireInstanceId) { try { return scheduler.interrupt(fireInstanceId); } catch (final UnableToInterruptJobException e) { throw new QuartzInterruptException("Failed to interrupt the job.", e); } }
Example #8
Source File: ScheduleService.java From elasticsearch-quartz with Apache License 2.0 | 5 votes |
public boolean interrupt(final JobKey jobKey) { try { return scheduler.interrupt(jobKey); } catch (final UnableToInterruptJobException e) { throw new QuartzInterruptException("Failed to interrupt the job.", e); } }
Example #9
Source File: MailFlowJob.java From elasticsearch-imap with Apache License 2.0 | 5 votes |
@Override public void interrupt() throws UnableToInterruptJobException { if (mailSource != null) { mailSource.close(); } }
Example #10
Source File: RestSource.java From ingestion with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public void stop() { client.destroy(); try { scheduler.interrupt(jobDetail.getKey()); } catch (UnableToInterruptJobException e) { log.error("RestSource error. " + e.getMessage()); } }
Example #11
Source File: Job.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
/** * @throws UnableToInterruptJobException */ @Override public void interrupt() throws UnableToInterruptJobException { // ask the step to interrupt if (currentStep != null) { currentStep.interrupt(); } // also attempt to interrupt the thread, to cause an InterruptedException if the step ever waits or sleeps workerThread.interrupt(); }
Example #12
Source File: QuartzSchedulerSPI.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
/** * Used by {@link QuartzTaskFuture#cancel(boolean)}. */ @Guarded(by = STARTED) public boolean cancelJob(final JobKey jobKey) { checkNotNull(jobKey); try (TcclBlock tccl = TcclBlock.begin(this)) { return scheduler.interrupt(jobKey); } catch (UnableToInterruptJobException e) { log.debug("Unable to interrupt job with key: {}", jobKey, e); } return false; }
Example #13
Source File: RemoteScheduler.java From AsuraFramework with Apache License 2.0 | 5 votes |
/** * @see org.quartz.Scheduler#interrupt(java.lang.String, java.lang.String) */ public boolean interrupt(String jobName, String groupName) throws UnableToInterruptJobException { try { return getRemoteScheduler().interrupt(schedCtxt, jobName, groupName); } catch (RemoteException re) { throw new UnableToInterruptJobException(invalidateHandleCreateException( "Error communicating with remote scheduler.", re)); } catch (SchedulerException se) { throw new UnableToInterruptJobException(se); } }
Example #14
Source File: RemoteMBeanScheduler.java From lams with GNU General Public License v2.0 | 5 votes |
/** * @see org.quartz.Scheduler#interrupt(JobKey) */ public boolean interrupt(JobKey jobKey) throws UnableToInterruptJobException { try { return (Boolean)invoke( "interruptJob", new Object[] { jobKey.getName(), jobKey.getGroup() }, new String[] { String.class.getName(), String.class.getName() }); } catch (SchedulerException se) { throw new UnableToInterruptJobException(se); } }
Example #15
Source File: RemoteMBeanScheduler.java From lams with GNU General Public License v2.0 | 5 votes |
public boolean interrupt(String fireInstanceId) throws UnableToInterruptJobException { try { return (Boolean)invoke( "interruptJob", new Object[] { fireInstanceId }, new String[] { String.class.getName() }); } catch (SchedulerException se) { throw new UnableToInterruptJobException(se); } }
Example #16
Source File: RemoteScheduler.java From lams with GNU General Public License v2.0 | 5 votes |
/** * @see org.quartz.Scheduler#interrupt(JobKey) */ public boolean interrupt(JobKey jobKey) throws UnableToInterruptJobException { try { return getRemoteScheduler().interrupt(jobKey); } catch (RemoteException re) { throw new UnableToInterruptJobException(invalidateHandleCreateException( "Error communicating with remote scheduler.", re)); } catch (SchedulerException se) { throw new UnableToInterruptJobException(se); } }
Example #17
Source File: QuartzScheduler.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Interrupt all instances of the identified InterruptableJob executing in * this Scheduler instance. * * <p> * This method is not cluster aware. That is, it will only interrupt * instances of the identified InterruptableJob currently executing in this * Scheduler instance, not across the entire cluster. * </p> * * @see org.quartz.core.RemotableQuartzScheduler#interrupt(JobKey) */ public boolean interrupt(JobKey jobKey) throws UnableToInterruptJobException { List<JobExecutionContext> jobs = getCurrentlyExecutingJobs(); JobDetail jobDetail = null; Job job = null; boolean interrupted = false; for(JobExecutionContext jec : jobs) { jobDetail = jec.getJobDetail(); if (jobKey.equals(jobDetail.getKey())) { job = jec.getJobInstance(); if (job instanceof InterruptableJob) { ((InterruptableJob)job).interrupt(); interrupted = true; } else { throw new UnableToInterruptJobException( "Job " + jobDetail.getKey() + " can not be interrupted, since it does not implement " + InterruptableJob.class.getName()); } } } return interrupted; }
Example #18
Source File: RemoteMBeanScheduler.java From AsuraFramework with Apache License 2.0 | 5 votes |
/** * @see org.quartz.Scheduler#interrupt(java.lang.String, java.lang.String) */ public boolean interrupt(String jobName, String groupName) throws UnableToInterruptJobException { try { return ((Boolean)invoke( "interrupt", new Object[] { schedulingContext, jobName, groupName}, new String[] { SchedulingContext.class.getName(), String.class.getName(), String.class.getName() })).booleanValue(); } catch (SchedulerException se) { throw new UnableToInterruptJobException(se); } }
Example #19
Source File: RemoteScheduler.java From lams with GNU General Public License v2.0 | 5 votes |
public boolean interrupt(String fireInstanceId) throws UnableToInterruptJobException { try { return getRemoteScheduler().interrupt(fireInstanceId); } catch (RemoteException re) { throw new UnableToInterruptJobException(invalidateHandleCreateException( "Error communicating with remote scheduler.", re)); } catch (SchedulerException se) { throw new UnableToInterruptJobException(se); } }
Example #20
Source File: GobblinServiceJobScheduler.java From incubator-gobblin with Apache License 2.0 | 4 votes |
@Override public void interrupt() throws UnableToInterruptJobException { log.info("Job was interrupted"); }
Example #21
Source File: CronJob.java From spring-boot-quartz-demo with MIT License | 4 votes |
@Override public void interrupt() throws UnableToInterruptJobException { System.out.println("Stopping thread... "); toStopFlag = false; }
Example #22
Source File: SimpleJob.java From spring-boot-quartz-demo with MIT License | 4 votes |
@Override public void interrupt() throws UnableToInterruptJobException { System.out.println("Stopping thread... "); toStopFlag = false; }
Example #23
Source File: StdScheduler.java From lams with GNU General Public License v2.0 | 4 votes |
public boolean interrupt(JobKey jobKey) throws UnableToInterruptJobException { return sched.interrupt(jobKey); }
Example #24
Source File: AuthzGroupProviderSync.java From sakai with Educational Community License v2.0 | 4 votes |
@Override public void interrupt() throws UnableToInterruptJobException { run = false; }
Example #25
Source File: StdScheduler.java From lams with GNU General Public License v2.0 | 4 votes |
public boolean interrupt(String fireInstanceId) throws UnableToInterruptJobException { return sched.interrupt(fireInstanceId); }
Example #26
Source File: AbstractScheduler.java From smarthome with Eclipse Public License 2.0 | 4 votes |
@Override public boolean interrupt(String fireInstanceId) throws UnableToInterruptJobException { throw new UnsupportedOperationException(); }
Example #27
Source File: AbstractScheduler.java From smarthome with Eclipse Public License 2.0 | 4 votes |
@Override public boolean interrupt(JobKey jobKey) throws UnableToInterruptJobException { throw new UnsupportedOperationException(); }
Example #28
Source File: AbstractInterruptableJob.java From syncope with Apache License 2.0 | 4 votes |
@Override public void interrupt() throws UnableToInterruptJobException { getDelegate().interrupt(); }
Example #29
Source File: JobScheduler.java From incubator-gobblin with Apache License 2.0 | 4 votes |
@Override public void interrupt() throws UnableToInterruptJobException { log.info("Job was interrupted"); }
Example #30
Source File: FoxbpmScheduler.java From FoxBPM with Apache License 2.0 | 4 votes |
public boolean interrupt(String fireInstanceId) throws UnableToInterruptJobException { // TODO Auto-generated method stub return false; }