org.quartz.Scheduler.unscheduleJob()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(226)

本文整理了Java中org.quartz.Scheduler.unscheduleJob()方法的一些代码示例,展示了Scheduler.unscheduleJob()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.unscheduleJob()方法的具体详情如下:
包路径:org.quartz.Scheduler
类名称:Scheduler
方法名:unscheduleJob

Scheduler.unscheduleJob介绍

[英]Remove the indicated Trigger from the scheduler.
[中]从计划程序中删除指示的Trigger

代码示例

代码示例来源:origin: xuxueli/xxl-job

/**
 * remove trigger + job
 *
 * @param jobName
 * @param jobGroup
 * @return
 * @throws SchedulerException
 */
public static boolean removeJob(String jobName, String jobGroup) throws SchedulerException {
  TriggerKey triggerKey = TriggerKey.triggerKey(jobName, jobGroup);
  if (scheduler.checkExists(triggerKey)) {
    scheduler.unscheduleJob(triggerKey);    // trigger + job
  }
  logger.info(">>>>>>>>>>> removeJob success, triggerKey:{}", triggerKey);
  return true;
}

代码示例来源:origin: gocd/gocd

private void unscheduleJob(String pipelineName) {
  try {
    JobKey jobKey = jobKey(pipelineName, PIPELINE_TRIGGGER_TIMER_GROUP);
    if (quartzScheduler.getJobDetail(jobKey) != null) {
      quartzScheduler.unscheduleJob(triggerKey(pipelineName, PIPELINE_TRIGGGER_TIMER_GROUP));
      quartzScheduler.deleteJob(jobKey);
    }
  } catch (SchedulerException e) {
    LOG.error("Could not unschedule quartz jobs", e);
  }
}

代码示例来源:origin: apache/shiro

scheduler.unscheduleJob(JOB_NAME, Scheduler.DEFAULT_GROUP);
if (log.isDebugEnabled()) {
  log.debug("Quartz session validation job stopped successfully.");

代码示例来源:origin: gocd/gocd

private void unscheduleExistingBackupJob() throws SchedulerException {
  if (quartzScheduler.getJobDetail(jobKey()) != null) {
    quartzScheduler.unscheduleJob(triggerKey());
    quartzScheduler.deleteJob(jobKey());
  }
}

代码示例来源:origin: quartz-scheduler/quartz

if (!triggerGroupsToNeverDelete.contains(groupName)) {
      for (TriggerKey key : scheduler.getTriggerKeys(GroupMatcher.triggerGroupEquals(groupName))) {
        scheduler.unscheduleJob(key);
    log.info("Deleting all triggers in group: {}", group);
    for (TriggerKey key : scheduler.getTriggerKeys(GroupMatcher.triggerGroupEquals(group))) {
      scheduler.unscheduleJob(key);
if(!triggerGroupsToNeverDelete.contains(key.getGroup())) {
  log.info("Deleting trigger: {}", key);
  scheduler.unscheduleJob(key);

代码示例来源:origin: quartz-scheduler/quartz

if (!triggerGroupsToNeverDelete.contains(groupName)) {
      for (TriggerKey key : scheduler.getTriggerKeys(GroupMatcher.triggerGroupEquals(groupName))) {
        scheduler.unscheduleJob(key);
    log.info("Deleting all triggers in group: {}", group);
    for (TriggerKey key : scheduler.getTriggerKeys(GroupMatcher.triggerGroupEquals(group))) {
      scheduler.unscheduleJob(key);
if(!triggerGroupsToNeverDelete.contains(key.getGroup())) {
  log.info("Deleting trigger: {}", key);
  scheduler.unscheduleJob(key);

代码示例来源:origin: quartz-scheduler/quartz

getScheduler().unscheduleJob(tKey);

代码示例来源:origin: quartz-scheduler/quartz

getScheduler().unscheduleJob(tKey);

代码示例来源:origin: Dreampie/Resty

/**
 * 停止任务
 */
public void stop() {
 long id = quartzKey.getId();
 String name = quartzKey.getName();
 String group = quartzKey.getGroup();
 SchedulerFactory factory = Quartzer.getSchedulerFactory();
 try {
  if (factory != null) {
   Scheduler scheduler = factory.getScheduler();
   TriggerKey triggerKey = TriggerKey.triggerKey(TRIGGER_MARK + SEPARATOR + name + SEPARATOR + id, GROUP_MARK + SEPARATOR + group + SEPARATOR + id);
   Trigger trigger = scheduler.getTrigger(triggerKey);
   if (trigger != null) {
    scheduler.pauseTrigger(triggerKey);
    scheduler.unscheduleJob(triggerKey);
    scheduler.deleteJob(trigger.getJobKey());
    Quartzer.removeQuartzJob(this);
   }
  }
 } catch (Exception e) {
  throw new QuartzException("Can't stop job.", e);
 }
}

代码示例来源:origin: Exrick/x-boot

/**
 * 删除定时任务
 * @param jobClassName
 */
public void delete(String jobClassName){
  try {
    scheduler.pauseTrigger(TriggerKey.triggerKey(jobClassName));
    scheduler.unscheduleJob(TriggerKey.triggerKey(jobClassName));
    scheduler.deleteJob(JobKey.jobKey(jobClassName));
  } catch (Exception e) {
    throw new XbootException("删除定时任务失败");
  }
}

代码示例来源:origin: OpenNMS/opennms

/** {@inheritDoc} */
@Override
public void removeTrigger(String triggerName) {
  try {
    m_scheduler.unscheduleJob(new TriggerKey(triggerName, m_triggerGroup));
  } catch (SchedulerException e) {
    LOG.error("exception when attempting to remove trigger {}", triggerName, e);
  }
}

代码示例来源:origin: org.opennms/opennms-web-api

/** {@inheritDoc} */
@Override
public void removeTrigger(String triggerName) {
  try {
    m_scheduler.unscheduleJob(new TriggerKey(triggerName, m_triggerGroup));
  } catch (SchedulerException e) {
    LOG.error("exception when attempting to remove trigger {}", triggerName, e);
  }
}

代码示例来源:origin: org.apache.camel/camel-quartz2

@Override
protected void doStop() throws Exception {
  if (trigger != null) {
    LOG.debug("Unscheduling trigger: {}", trigger.getKey());
    quartzScheduler.unscheduleJob(trigger.getKey());
  }
}

代码示例来源:origin: opendedup/sdfs

public void stopSchedules() {
  try {
    sched.unscheduleJob("syncgc", null);
    sched.deleteJob("syncgc", null);
  } catch (Exception e) {
    SDFSLogger.getLog().error("unable to stop schedule", e);
  }
}

代码示例来源:origin: sakaiproject/sakai

@Transactional(propagation = REQUIRES_NEW)
public void deleteDelayedInvocation(String uuid) {
  log.debug("Removing Delayed Invocation: " + uuid);
  try {
    TriggerKey key = new TriggerKey(uuid, GROUP_NAME);
    schedulerFactory.getScheduler().unscheduleJob(key);
    dao.remove(uuid);
  } catch (SchedulerException e) {
    log.error("Failed to remove Delayed Invocation: uuid="+ uuid, e);
  }
}

代码示例来源:origin: org.apache.camel/camel-quartz

public void deleteJob(String name, String group) throws SchedulerException {
  if (isClustered()) {
    // do not pause jobs which are clustered, as we want the jobs to continue running on the other nodes
    LOG.debug("Cannot delete job using trigger: {}/{} as the JobStore is clustered.", group, name);
  } else {
    Trigger trigger = getScheduler().getTrigger(name, group);
    if (trigger != null) {
      LOG.debug("Deleting job using trigger: {}/{}", group, name);
      getScheduler().unscheduleJob(name, group);
    }
  }
}

代码示例来源:origin: com.atlassian.scheduler/atlassian-scheduler-quartz1

boolean deleteTrigger(final JobId jobId) {
  try {
    return getScheduler().unscheduleJob(jobId.toString(), QUARTZ_TRIGGER_GROUP);
  } catch (SchedulerException se) {
    logWarn("Error removing Quartz trigger for '{}'", jobId, se);
    return false;
  }
}

代码示例来源:origin: com.sitewhere/sitewhere-core

@Override
public void unscheduleJob(IScheduledJob job) throws SiteWhereException {
try {
  getScheduler().unscheduleJob(new TriggerKey(job.getToken()));
} catch (SchedulerException e) {
  throw new SiteWhereException("Unable to unschedule job.", e);
}
}

代码示例来源:origin: org.apache.syncope.core/syncope-core-provisioning-java

private void unregisterJob(final String jobName) {
  try {
    scheduler.getScheduler().unscheduleJob(new TriggerKey(jobName, Scheduler.DEFAULT_GROUP));
    scheduler.getScheduler().deleteJob(new JobKey(jobName, Scheduler.DEFAULT_GROUP));
  } catch (SchedulerException e) {
    LOG.error("Could not remove job " + jobName, e);
  }
  if (ApplicationContextProvider.getBeanFactory().containsSingleton(jobName)) {
    ApplicationContextProvider.getBeanFactory().destroySingleton(jobName);
  }
}

代码示例来源:origin: xkcoding/spring-boot-demo

/**
 * 删除定时任务
 *
 * @param form 表单参数 {@link JobForm}
 * @throws SchedulerException 异常
 */
@Override
public void deleteJob(JobForm form) throws SchedulerException {
  scheduler.pauseTrigger(TriggerKey.triggerKey(form.getJobClassName(), form.getJobGroupName()));
  scheduler.unscheduleJob(TriggerKey.triggerKey(form.getJobClassName(), form.getJobGroupName()));
  scheduler.deleteJob(JobKey.jobKey(form.getJobClassName(), form.getJobGroupName()));
}

相关文章