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

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

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

Scheduler.getJobKeys介绍

[英]Get the keys of all the org.quartz.JobDetails in the matching groups.
[中]

代码示例

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

private void unscheduleAllJobs() {
  try {
    Set<JobKey> jobKeys = quartzScheduler.getJobKeys(groupEquals(PIPELINE_TRIGGGER_TIMER_GROUP));
    for (JobKey jobKey : jobKeys) {
      unscheduleJob(jobKey.getName());
    }
  } catch (SchedulerException e) {
    LOG.error("Could not unschedule quartz jobs", e);
  }
}

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

@Override
public void cancelAll(String deadlineName) {
  runOnPrepareCommitOrNow(() -> {
    try {
      scheduler.getJobKeys(GroupMatcher.groupEquals(deadlineName))
           .forEach(this::cancelSchedule);
    } catch (SchedulerException e) {
      throw new DeadlineException("An error occurred while cancelling a timer for a deadline manager", e);
    }
  });
}

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

for (JobKey jobKey : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName)))

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

@Override
  @SuppressWarnings("unchecked")
  public Set<String> getScheduledJobIds() throws KairosDBException
  {
    Set<String> scheduledJobs = new HashSet<String>();
    try
    {
      for (String groupName : scheduler.getJobGroupNames())
      {
        for (JobKey jobKey : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName)))
        {
          scheduledJobs.add(jobKey.getName());
        }
      }
    }
    catch (SchedulerException e)
    {
      throw new KairosDBException("Could not get scheduled jobs." + e);
    }

    return scheduledJobs;
  }
}

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

for (String groupName : scheduler.getJobGroupNames()) {
  if (!jobGroupsToNeverDelete.contains(groupName)) {
    for (JobKey key : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
      scheduler.deleteJob(key);
if(!jobGroupsToNeverDelete.contains(group)) {
  log.info("Deleting all jobs in group: {}", group);
  for (JobKey key : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(group))) {
    scheduler.deleteJob(key);

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

for (String groupName : scheduler.getJobGroupNames()) {
  if (!jobGroupsToNeverDelete.contains(groupName)) {
    for (JobKey key : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
      scheduler.deleteJob(key);
if(!jobGroupsToNeverDelete.contains(group)) {
  log.info("Deleting all jobs in group: {}", group);
  for (JobKey key : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(group))) {
    scheduler.deleteJob(key);

代码示例来源:origin: net.sf.ehcache/ehcache

private void waitForOutstandingJobCount(JobExecutionContext context, ScheduledRefreshConfiguration config,
                    Scheduler scheduler, int minCount) throws SchedulerException {
 GroupMatcher<JobKey> matcher = GroupMatcher.jobGroupEquals(context.getJobDetail().getKey().getGroup());
 for (Set<JobKey> queuedKeys = scheduler.getJobKeys(matcher); (!scheduler.isShutdown())
   && (queuedKeys.size() > minCount); queuedKeys = scheduler.getJobKeys(matcher)) {
   try {
    Thread.sleep(config.getPollTimeMs());
   } catch (InterruptedException e) {
   }
 }
}

代码示例来源:origin: net.sf.ehcache/ehcache

private int getOutstandingJobCount(JobExecutionContext context, Scheduler scheduler) throws SchedulerException {
 GroupMatcher<JobKey> matcher = GroupMatcher.jobGroupEquals(context.getJobDetail().getKey().getGroup());
 Set<JobKey> queuedKeys = scheduler.getJobKeys(matcher);
 return queuedKeys.size();
}

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

Scheduler scheduler = schedulerFactoryBean.getScheduler();
GroupMatcher<JobKey> matcher = GroupMatcher.anyJobGroup();
Set<JobKey> jobKeys = scheduler.getJobKeys(matcher);
List<ScheduleJob> jobList = new ArrayList<ScheduleJob>();
for (JobKey jobKey : jobKeys) {

代码示例来源:origin: org.codelibs/elasticsearch-quartz

public Set<JobKey> getJobKeys(final GroupMatcher<JobKey> matcher) {
  try {
    return scheduler.getJobKeys(matcher);
  } catch (final SchedulerException e) {
    throw new QuartzSchedulerException(e);
  }
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

private int getOutstandingJobCount(JobExecutionContext context, Scheduler scheduler) throws SchedulerException {
 GroupMatcher<JobKey> matcher = GroupMatcher.jobGroupEquals(context.getJobDetail().getKey().getGroup());
 Set<JobKey> queuedKeys = scheduler.getJobKeys(matcher);
 return queuedKeys.size();
}

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

/**
 * Recuperar as chaves de todos os jobs agendados
 * por meio deste objeto.
 *
 * @return um set com todas as chaves, caso não exista nenhuma
 *          retorna um set vazio.
 * @throws SchedulerException
 */
public Set<JobKey> getAllJobKeys() throws SchedulerException {
  return getScheduler().getJobKeys(GroupMatcher.anyGroup());
}

代码示例来源:origin: org.axonframework/axon-core

@Override
public void cancelAll(String deadlineName) {
  runOnPrepareCommitOrNow(() -> {
    try {
      scheduler.getJobKeys(GroupMatcher.groupEquals(deadlineName))
           .forEach(this::cancelSchedule);
    } catch (SchedulerException e) {
      throw new DeadlineException("An error occurred while cancelling a timer for a deadline manager", e);
    }
  });
}

代码示例来源:origin: org.axonframework/axon-messaging

@Override
public void cancelAll(String deadlineName) {
  runOnPrepareCommitOrNow(() -> {
    try {
      scheduler.getJobKeys(GroupMatcher.groupEquals(deadlineName))
           .forEach(this::cancelSchedule);
    } catch (SchedulerException e) {
      throw new DeadlineException("An error occurred while cancelling a timer for a deadline manager", e);
    }
  });
}

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

private void unschedulePolls() throws Exception {
  if (m_scheduler.isShutdown()) {
    // no need to unschedule in this case
    return;
  }
  for (JobKey jobKey : m_scheduler.getJobKeys(GroupMatcher.<JobKey>groupEquals(PollJobDetail.GROUP))) {
    m_scheduler.deleteJob(jobKey);
  }
}

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

private void removeCurrentJobsFromSchedule()  {
  synchronized (m_lock) {
    try {
      for (JobKey key : m_scheduler.getJobKeys(GroupMatcher.<JobKey>groupEquals(JOB_GROUP))) {
        getScheduler().deleteJob(key);
      }
    } catch (SchedulerException e) {
      LOG.error("removeCurrentJobsFromSchedule: {}", e.getMessage(), e);
    }
  }
}

代码示例来源:origin: com.threewks.thundr/thundr-contrib-quartz

@Override
public Set<JobKey> getJobKeys(GroupMatcher<JobKey> matcher) throws QuartzException {
  try {
    return delegate.getJobKeys(matcher);
  } catch (SchedulerException e) {
    Logger.error(e.getMessage());
    throw new QuartzException(e);
  }
}

代码示例来源:origin: mbok/logsniffer

protected void stopAndDeleteAllSnifferJobs(final long snifferId) throws SchedulerException {
  for (final JobKey job : scheduler.getJobKeys(GroupMatcher.jobGroupEquals("SNIFFER:" + snifferId))) {
    logger.info("Deleting scheduled job for sniffer={} and log source={}", snifferId, getLogSourceId(job));
    scheduler.deleteJob(job);
    logger.info("Interrupting job for sniffer={} and log source={}", snifferId, getLogSourceId(job));
    scheduler.interrupt(job);
  }
}

代码示例来源:origin: org.opennms.features.poller/org.opennms.features.poller.remote

private void unschedulePolls() throws Exception {
  if (m_scheduler.isShutdown()) {
    // no need to unschedule in this case
    return;
  }
  for (JobKey jobKey : m_scheduler.getJobKeys(GroupMatcher.<JobKey>groupEquals(PollJobDetail.GROUP))) {
    m_scheduler.deleteJob(jobKey);
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-scheduler-api

private void onWikiDeletedEvent(String wikiId) throws SchedulerException
{
  Set<JobKey> keys = getScheduler().getJobKeys(GroupMatcher.anyJobGroup());
  String idPrefix = getWikiIdPrefix(wikiId);
  for (JobKey key : keys) {
    if (key.getName().startsWith(idPrefix)) {
      getScheduler().deleteJob(key);
    }
  }
}

相关文章