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

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

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

Scheduler.getJobGroupNames介绍

[英]Get the names of all known org.quartz.JobDetail groups.
[中]获取所有已知org.quartz.JobDetail组的名称。

代码示例

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

for (String groupName : scheduler.getJobGroupNames())

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

try {
 final Scheduler quartzScheduler = this.scheduler.getScheduler();
 final List<String> groupNames = quartzScheduler.getJobGroupNames();

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

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

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

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

代码示例来源:origin: org.rhq/rhq-enterprise-server

public String[] getJobGroupNames() throws SchedulerException {
  return scheduler.getJobGroupNames();
}

代码示例来源:origin: org.rhq/rhq-enterprise-server

public String[] getJobGroupNames() throws SchedulerException {
  return this.scheduler.getJobGroupNames();
}

代码示例来源:origin: org.kuali.kfs/kfs-core

public List<String> getSchedulerGroups() {
  try {
    return Arrays.asList(scheduler.getJobGroupNames());
  }
  catch (SchedulerException ex) {
    throw new RuntimeException("Exception while obtaining job list", ex);
  }
}

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

public List<String> getJobGroupNames() {
  try {
    return scheduler.getJobGroupNames();
  } catch (final SchedulerException e) {
    throw new QuartzSchedulerException(e);
  }
}

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

public List<String> getJobGroupNames() {
  try {
    return scheduler.getJobGroupNames();
  } catch (SchedulerException e) {
    throw new QuartzRuntimeException(e);
  }
}

代码示例来源:origin: OpenWiseSolutions/openhub-framework

@Override
public List<String> getJobGroupNames() throws SchedulerException {
  return getScheduler().getJobGroupNames();
}

代码示例来源:origin: com.blazebit/blaze-quartz-utils

public static List<JobDetail> getJobs(Scheduler sched)
    throws SchedulerException {
  List<JobDetail> jobDetails = new ArrayList<JobDetail>();
  List<String> jobGroups = sched.getJobGroupNames();
  for (int i = 0; i < jobGroups.size(); i++) {
    String name = jobGroups.get(i);
    Set<JobKey> keys = sched.getJobKeys(GroupMatcher
        .jobGroupEquals(name));
    Iterator<JobKey> iter = keys.iterator();
    while (iter.hasNext()) {
      jobDetails.add(sched.getJobDetail(iter.next()));
    }
  }
  return jobDetails;
}

代码示例来源:origin: org.exoplatform.kernel/exo.kernel.component.common

public List<JobDetail> getAllJobs() throws Exception
{
 List<JobDetail> jlist = new ArrayList<JobDetail>();
 List<String> jgroups = scheduler_.getJobGroupNames();
 for (int i = 0, length = jgroups.size(); i < length; i++)
 {
   Set<JobKey> jkeys = scheduler_.getJobKeys(GroupMatcher.jobGroupEquals(jgroups.get(i)));
   for (JobKey jkey : jkeys)
   {
    jlist.add(scheduler_.getJobDetail(jkey));
   }
 }
 return jlist;
}

代码示例来源:origin: stackoverflow.com

Scheduler sched = new StdSchedulerFactory().getScheduler();

for(String group: sched.getJobGroupNames()) {
  for(JobKey jobKey : sched.getJobKeys(GroupMatcher.jobGroupEquals(group))) {
   ...
  }
}

代码示例来源:origin: stackoverflow.com

for(Scheduler schedule :StdSchedulerFactory().getAllSchedulers()){
     System.out.println(schedule.getJobGroupNames().size()+" "+schedule.isShutdown());
     for (String groupName : schedule.getJobGroupNames()) {
       for (JobKey jobKey : schedule.getJobKeys(GroupMatcher
           .jobGroupEquals(groupName))) {
         String jobName = jobKey.getName();
         String jobGroup = jobKey.getGroup();
         List<Trigger> triggers = (List<Trigger>) schedule
             .getTriggersOfJob(jobKey);
         Date nextFireTime = triggers.get(0).getNextFireTime();
         System.out.println("[jobName] : " + jobName + " [groupName] : "
             + jobGroup + " - " + nextFireTime);
       }
     }
 }

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

@Override
public List<String> getJobGroupNames() throws QuartzException {
  try {
    return delegate.getJobGroupNames();
  } catch (SchedulerException e) {
    Logger.error(e.getMessage());
    throw new QuartzException(e);
  }
}

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

@Override
public List<String> getJobGroupNames() throws QuartzException {
  try {
    return delegate.getJobGroupNames();
  } catch (SchedulerException e) {
    Logger.error(e.getMessage());
    throw new QuartzException(e);
  }
}

代码示例来源:origin: stackoverflow.com

Scheduler scheduler = getScheduler();
 try {
   // All scheduled jobs
   for (String groupName : scheduler.getJobGroupNames()) {
     for (JobKey jobKey : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
       JobDetail jobDetail = scheduler.getJobDetail(jobKey);
       final List<? extends Trigger> triggersOfJob = scheduler.getTriggersOfJob(jobKey);
       // Do something with the info you just got
       // ...
     }
   }
 } catch (SchedulerException e) {
   log.error("Retrieving jobs", e);
 }

代码示例来源:origin: stackoverflow.com

Scheduler scheduler = new StdSchedulerFactory().getScheduler();
 for (String groupName : scheduler.getJobGroupNames()) {
  for (JobKey jobKey : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
  String jobName = jobKey.getName();
  String jobGroup = jobKey.getGroup();
  //get job's trigger
  List<Trigger> triggers = (List<Trigger>) scheduler.getTriggersOfJob(jobKey);
  Date nextFireTime = triggers.get(0).getNextFireTime(); 
  Date currTime = new Date();
  if(currTime>nextFireTime )     
   System.out.println("[jobName] : " + jobName + " [groupName] : "
     + jobGroup + " - " + has already executed);
  }
 }

相关文章