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

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

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

Scheduler.pauseJob介绍

[英]Pause the org.quartz.JobDetail with the given name - by pausing all of its current Triggers.
[中]暂停具有给定名称的org.quartz.JobDetail——暂停所有当前的Triggers。

代码示例

代码示例来源:origin: wuyouzhuguli/FEBS-Shiro

/**
 * 暂停任务
 */
public static void pauseJob(Scheduler scheduler, Long jobId) {
  try {
    scheduler.pauseJob(getJobKey(jobId));
  } catch (SchedulerException e) {
    log.error("暂停定时任务失败", e);
  }
}

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

/**
 * pause a job given the groupname. since pausing request might be issued concurrently,
 * so synchronized is added to ensure thread safety.
 */
public synchronized void pauseJob(final String jobName, final String groupName)
  throws SchedulerException {
 checkJobExistence(jobName, groupName);
 this.scheduler.pauseJob(new JobKey(jobName, groupName));
}

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

void pauseJob(JobDetail jobDetail, Scheduler scheduler) throws SchedulerException {
  scheduler.pauseJob(jobDetail.getName(), jobDetail.getGroup());
}

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

@RequestMapping(value = "/pause",method = RequestMethod.POST)
@ApiOperation(value = "暂停定时任务")
public Result<Object> pauseJob(@ModelAttribute QuartzJob job){
  try {
    scheduler.pauseJob(JobKey.jobKey(job.getJobClassName()));
  } catch (SchedulerException e) {
    throw new XbootException("暂停定时任务失败");
  }
  job.setStatus(CommonConstant.STATUS_DISABLE);
  quartzJobService.update(job);
  return new ResultUtil<Object>().setSuccessMsg("暂停定时任务成功");
}

代码示例来源:origin: bill1012/AdminEAP

/**
 * 暂停
 */
public void pauseJob(ScheduleJob scheduleJob) throws SchedulerException {
  Scheduler scheduler = schedulerFactoryBean.getScheduler();
  JobKey jobKey = JobKey.jobKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
  scheduler.pauseJob(jobKey);
}

代码示例来源:origin: sanluan/PublicCMS

/**
 * 暂停任务计划
 * 
 * @param site
 * @param id
 */
public void pause(SysSite site, Integer id) {
  if (CommonUtils.notEmpty(id)) {
    Date startTime = CommonUtils.getDate();
    try {
      scheduler.pauseJob(JobKey.jobKey(getTaskName(id)));
    } catch (SchedulerException e) {
      sysTaskService.updateStatus(id, TASK_STATUS_ERROR);
      logTaskService.save(new LogTask(site.getId(), id, startTime, CommonUtils.getDate(), false, e.getMessage()));
    }
  }
}

代码示例来源:origin: sanluan/PublicCMS

/**
 * 暂停任务计划
 * 
 * @param site
 * @param id
 */
public void pause(SysSite site, Integer id) {
  if (CommonUtils.notEmpty(id)) {
    Date startTime = CommonUtils.getDate();
    try {
      scheduler.pauseJob(JobKey.jobKey(getTaskName(id)));
    } catch (SchedulerException e) {
      sysTaskService.updateStatus(id, TASK_STATUS_ERROR);
      logTaskService.save(new LogTask(site.getId(), id, startTime, CommonUtils.getDate(), false, e.getMessage()));
    }
  }
}

代码示例来源:origin: io.antmedia/ant-media-server-common

/** {@inheritDoc} */
public void pauseScheduledJob(String name) {
  try {
    scheduler.pauseJob(keyMap.get(name).jKey);
  } catch (SchedulerException ex) {
    throw new RuntimeException(ex);
  }
}

代码示例来源:origin: lerry903/RuoYi

/**
 * 暂停任务
 */
public static void pauseJob(Scheduler scheduler, Long jobId) {
  try {
    scheduler.pauseJob(getJobKey(jobId));
  } catch (SchedulerException e) {
    log.error("pauseJob 异常:" , e);
  }
}

代码示例来源:origin: com.soento/soento-cms

public void pauseJob(Class<? extends Job> jobClass, String jobGroupName) {
  try {
    scheduler.pauseJob(JobKey.jobKey(jobClass.getName(), jobGroupName));
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: myschedule/myschedule-quartz-extra

public void pauseJob(JobKey jobKey) {
  try {
    scheduler.pauseJob(jobKey);
  } catch (SchedulerException e) {
    throw new QuartzRuntimeException(e);
  }
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * pauses a job with the given jobId assuming the job is in the default quartz group
 */
@Override
public void pauseJob(String jobId) {
  try {
    sched.pauseJob(jobKey(jobId, Scheduler.DEFAULT_GROUP));
  } catch (SchedulerException se) {
    log.error("failed to pause a job with id={}: {}", jobId, se.getMessage());
    log.debug("Exception", se);
  }
}

代码示例来源:origin: yzcheng90/X-SpringBoot

/**
 * 暂停任务
 */
public static void pauseJob(Scheduler scheduler, Long jobId) {
  try {
    scheduler.pauseJob(getJobKey(jobId));
  } catch (SchedulerException e) {
    throw new RRException("暂停定时任务失败", e);
  }
}

代码示例来源:origin: yjjdick/sdb-mall

/**
 * 暂停任务
 */
public static void pauseJob(Scheduler scheduler, Long jobId) {
  try {
    scheduler.pauseJob(getJobKey(jobId));
  } catch (SchedulerException e) {
    throw new RRException("暂停定时任务失败", e);
  }
}

代码示例来源:origin: org.apache.deltaspike.modules/deltaspike-scheduler-module-impl

@Override
public void pauseJob(Class<? extends T> jobClass)
{
  try
  {
    this.scheduler.pauseJob(createJobKey(jobClass));
  }
  catch (SchedulerException e)
  {
    throw ExceptionUtils.throwAsRuntimeException(e);
  }
}

代码示例来源:origin: muyinchen/migo-security

/**
 * 暂停任务
 */
public static void pauseJob(Scheduler scheduler, Long jobId) {
  try {
    scheduler.pauseJob(getJobKey(jobId));
  } catch (SchedulerException e) {
    throw new RRException("暂停定时任务失败", e);
  }
}

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

/**
 * 暂停定时任务
 *
 * @param form 表单参数 {@link JobForm}
 * @throws SchedulerException 异常
 */
@Override
public void pauseJob(JobForm form) throws SchedulerException {
  scheduler.pauseJob(JobKey.jobKey(form.getJobClassName(), form.getJobGroupName()));
}

代码示例来源:origin: apache/incubator-griffin

private void pauseJob(StreamingJob job) throws SchedulerException {
  String name = job.getName();
  String group = job.getGroup();
  List<? extends Trigger> triggers = jobService.getTriggers(name, group);
  if (!CollectionUtils.isEmpty(triggers)) {
    factory.getScheduler().pauseJob(JobKey.jobKey(name, group));
  }
}

代码示例来源:origin: bonitasoft/bonita-engine

@Override
public boolean delete(final String jobName, final String groupName) throws SSchedulerException {
  try {
    checkSchedulerState();
    final JobKey jobKey = jobKey(jobName, groupName);
    scheduler.pauseJob(jobKey);
    return scheduler.deleteJob(jobKey);
  } catch (final SchedulerException e) {
    throw new SSchedulerException(e);
  }
}

代码示例来源:origin: pentaho/pentaho-platform

/** {@inheritDoc} */
public void pauseJob( String jobId ) throws SchedulerException {
 try {
  Scheduler scheduler = getQuartzScheduler();
  scheduler.pauseJob( jobId, QuartzJobKey.parse( jobId ).getUserName() );
 } catch ( org.quartz.SchedulerException e ) {
  throw new SchedulerException( Messages.getInstance()
    .getString( "QuartzScheduler.ERROR_0005_FAILED_TO_PAUSE_JOBS" ), e ); //$NON-NLS-1$
 }
}

相关文章