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

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

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

Scheduler.getJobDetail介绍

[英]Get the JobDetail for the Job instance with the given name and group.
[中]获取具有给定名称和组的Job实例的JobDetail

代码示例

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

public boolean ifJobExist(final String jobName, final String groupName)
  throws SchedulerException {
 return this.scheduler.getJobDetail(new JobKey(jobName, groupName)) != null;
}

代码示例来源: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: javamelody/javamelody

List<JobDetail> getAllJobsOfScheduler(Scheduler scheduler) throws SchedulerException {
  final List<JobDetail> result = new ArrayList<JobDetail>();
  for (final String jobGroupName : scheduler.getJobGroupNames()) {
    for (final String jobName : scheduler.getJobNames(jobGroupName)) {
      final JobDetail jobDetail;
      try {
        jobDetail = scheduler.getJobDetail(jobName, jobGroupName);
        // le job peut être terminé et supprimé depuis la ligne ci-dessus
        if (jobDetail != null) {
          result.add(jobDetail);
        }
      } catch (final Exception e) {
        // si les jobs sont persistés en base de données, il peut y avoir une exception
        // dans getJobDetail, par exemple si la classe du job n'existe plus dans l'application
        LOG.debug(e.toString(), e);
      }
    }
  }
  return result;
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Add the given job to the Scheduler, if it doesn't already exist.
 * Overwrites the job in any case if "overwriteExistingJobs" is set.
 * @param jobDetail the job to add
 * @return {@code true} if the job was actually added,
 * {@code false} if it already existed before
 * @see #setOverwriteExistingJobs
 */
private boolean addJobToScheduler(JobDetail jobDetail) throws SchedulerException {
  if (this.overwriteExistingJobs || getScheduler().getJobDetail(jobDetail.getKey()) == null) {
    getScheduler().addJob(jobDetail, true);
    return true;
  }
  else {
    return false;
  }
}

代码示例来源:origin: kiegroup/jbpm

@Override
public boolean isValid(GlobalJobHandle jobHandle) {
  if (scheduler != null && !isTransactional()) {
    return true;
  }
  JobDetail jobDetail = null;
  try {
    jobDetail = scheduler.getJobDetail(jobKey(((GlobalQuartzJobHandle)jobHandle).getJobName(), ((GlobalQuartzJobHandle)jobHandle).getJobGroup()));
  } catch (SchedulerException e) {
    logger.warn("Cannot fetch job detail for job handle {}", jobHandle);
  }
  return jobDetail != null;
}

代码示例来源:origin: spring-projects/spring-framework

try {
  if (jobDetail != null && this.jobDetails != null && !this.jobDetails.contains(jobDetail) &&
      (this.overwriteExistingJobs || getScheduler().getJobDetail(jobDetail.getKey()) == null)) {
    getScheduler().scheduleJob(jobDetail, trigger);
    this.jobDetails.add(jobDetail);

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

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

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

ScheduledFlowTrigger scheduledFlowTrigger = null;
try {
 final JobDetail job = quartzScheduler.getJobDetail(jobKey);
 final JobDataMap jobDataMap = job.getJobDataMap();

代码示例来源:origin: org.springframework/spring-context-support

/**
 * Add the given job to the Scheduler, if it doesn't already exist.
 * Overwrites the job in any case if "overwriteExistingJobs" is set.
 * @param jobDetail the job to add
 * @return {@code true} if the job was actually added,
 * {@code false} if it already existed before
 * @see #setOverwriteExistingJobs
 */
private boolean addJobToScheduler(JobDetail jobDetail) throws SchedulerException {
  if (this.overwriteExistingJobs || getScheduler().getJobDetail(jobDetail.getKey()) == null) {
    getScheduler().addJob(jobDetail, true);
    return true;
  }
  else {
    return false;
  }
}

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

public synchronized boolean isJobPaused(final String jobName, final String groupName)
  throws SchedulerException {
 final JobKey jobKey = new JobKey(jobName, groupName);
 final JobDetail jobDetail = this.scheduler.getJobDetail(jobKey);
 final List<? extends Trigger> triggers = this.scheduler.getTriggersOfJob(jobDetail.getKey());
 for (final Trigger trigger : triggers) {
  final TriggerState triggerState = this.scheduler.getTriggerState(trigger.getKey());
  if (TriggerState.PAUSED.equals(triggerState)) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: org.springframework/spring-context-support

try {
  if (jobDetail != null && this.jobDetails != null && !this.jobDetails.contains(jobDetail) &&
      (this.overwriteExistingJobs || getScheduler().getJobDetail(jobDetail.getKey()) == null)) {
    getScheduler().scheduleJob(jobDetail, trigger);
    this.jobDetails.add(jobDetail);

代码示例来源:origin: kiegroup/jbpm

JobDetail jobDetail = scheduler.getJobDetail(jobKey(quartzJobHandle.getJobName(), quartzJobHandle.getJobGroup()));
if (jobDetail == null) {
  scheduler.scheduleJob(jobq, triggerq);

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

dupeJ = sched.getJobDetail(detail.getKey());
} catch (JobPersistenceException e) {
  if (e.getCause() instanceof ClassNotFoundException && isOverWriteExistingData()) {

代码示例来源:origin: kiegroup/jbpm

JobDetail jobDetail = scheduler.getJobDetail(jobKey(jobname, groupName));

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

dupeJ = sched.getJobDetail(detail.getKey());
} catch (JobPersistenceException e) {
  if (e.getCause() instanceof ClassNotFoundException && isOverWriteExistingData()) {

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

Assert.assertTrue(jss1 instanceof QuartzJobSchedule);
QuartzJobSchedule qjss1 = (QuartzJobSchedule)jss1;
Assert.assertNotNull(scheduler._scheduler.getScheduler().getJobDetail(qjss1.getQuartzTrigger().getJobKey()));
Assert.assertNotNull(scheduler._scheduler.getScheduler().getTrigger(qjss1.getQuartzTrigger().getKey()));
Assert.assertTrue(qjss1.getQuartzTrigger().mayFireAgain());

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

job.setJobClass(scheduler.getJobDetail(jobKey).getJobClass().getName());
Trigger.TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
job.setJobStatus(triggerState.name());

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

job.setJobClass(scheduler.getJobDetail(jobKey).getJobClass().getName());
Trigger.TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
job.setJobStatus(triggerState.name());

代码示例来源:origin: org.opensingular/singular-schedule

/**
 * Verify if the job detail exists.
 *
 * @param jobDetail the job detail.
 * @return {@code true} if exists; {@code false} otherwise.
 */
private boolean jobDetailExists(JobDetail jobDetail) throws SchedulerException {
  return (getScheduler().getJobDetail(jobDetail.getKey()) != null);
}

代码示例来源:origin: cdapio/cdap

private void verifyJobAndTriggers(JobKey jobKey, int expectedTriggersSize,
                 Trigger.TriggerState expectedTriggerState) throws SchedulerException {
 JobDetail jobStored = scheduler.getJobDetail(jobKey);
 List<? extends Trigger> triggers = scheduler.getTriggersOfJob(jobKey);
 Assert.assertEquals(jobStored.getKey().getName(), jobKey.getName());
 Assert.assertEquals(expectedTriggersSize, triggers.size());
 verifyTriggerState(triggers, expectedTriggerState);
}

相关文章