org.quartz.Trigger.getDescription()方法的使用及代码示例

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

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

Trigger.getDescription介绍

[英]Return the description given to the Trigger instance by its creator (if any).
[中]返回创建者(如果有)给Trigger实例的描述。

代码示例

代码示例来源:origin: jooby-project/jooby

private Object describe(final Trigger trigger) {
  if (trigger.getDescription() != null) {
   return trigger.getDescription();
  }
  if (trigger instanceof SimpleTrigger) {
   return "will fire every " + ((SimpleTrigger) trigger).getRepeatInterval() + "ms";
  }
  if (trigger instanceof CronTrigger) {
   return "will fire at " + ((CronTrigger) trigger).getCronExpression();
  }
  if (trigger instanceof CalendarIntervalTrigger) {
   CalendarIntervalTrigger calendar = (CalendarIntervalTrigger) trigger;
   return "will fire every " + calendar.getRepeatInterval() + " "
     + calendar.getRepeatIntervalUnit();
  }
  if (trigger instanceof DailyTimeIntervalTrigger) {
   DailyTimeIntervalTrigger daily = (DailyTimeIntervalTrigger) trigger;
   return "will fire every " + daily.getRepeatInterval() + " "
     + daily.getRepeatIntervalUnit();
  }
  return trigger;
 }
}

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

public static CompositeData toCompositeData(Trigger trigger) {
  try {
    return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
        new Object[] {
            trigger.getKey().getName(),
            trigger.getKey().getGroup(),
            trigger.getJobKey().getName(),
            trigger.getJobKey().getGroup(),
            trigger.getDescription(),
            JobDataMapSupport.toTabularData(trigger
                .getJobDataMap()),
            trigger.getCalendarName(),
            ((OperableTrigger)trigger).getFireInstanceId(),
            trigger.getMisfireInstruction(),
            trigger.getPriority(), trigger.getStartTime(),
            trigger.getEndTime(), trigger.getNextFireTime(),
            trigger.getPreviousFireTime(),
            trigger.getFinalFireTime() });
  } catch (OpenDataException e) {
    throw new RuntimeException(e);
  }
}

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

/**
 * 获取运行中的任务
 */
public List<ScheduleJob> getRunningJobs() throws SchedulerException {
  Scheduler scheduler = schedulerFactoryBean.getScheduler();
  List<JobExecutionContext> executingJobs = scheduler.getCurrentlyExecutingJobs();
  List<ScheduleJob> jobList = new ArrayList<ScheduleJob>(executingJobs.size());
  for (JobExecutionContext executingJob : executingJobs) {
    ScheduleJob job = new ScheduleJob();
    JobDetail jobDetail = executingJob.getJobDetail();
    JobKey jobKey = jobDetail.getKey();
    Trigger trigger = executingJob.getTrigger();
    job.setJobId(jobKey.getGroup() + "_" + jobKey.getName());
    job.setJobName(jobKey.getName());
    job.setJobGroup(jobKey.getGroup());
    job.setDesc(trigger.getDescription());
    Trigger.TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
    job.setJobStatus(triggerState.name());
    if (trigger instanceof CronTrigger) {
      CronTrigger cronTrigger = (CronTrigger) trigger;
      String cronExpression = cronTrigger.getCronExpression();
      job.setCronExpression(cronExpression);
    }
    jobList.add(job);
  }
  return jobList;
}

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

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

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

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

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

private void logTriggerInfo(Trigger trigger, String message) {
  LOG.debug(message, trigger.getDescription());
}

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

@Override
  public void execute(JobExecutionContext context) throws JobExecutionException {
    String description = context.getTrigger().getDescription();
    System.out.println("hello quartz. description:" + description + ", current time:" + new Date());
  }
}

代码示例来源:origin: yejq/quartz-spring-manager

@RequestMapping(value = "/editTrigger", method = RequestMethod.GET)
public String editTrigger(String name, String group, Model model) {
  Trigger trigger = null;
  try {
    trigger = scheduler.getTrigger(name, group);
  } catch (SchedulerException e) {
    e.printStackTrace();
  }
  String des = trigger.getDescription();
  while (des.endsWith(SchedulerUtil.PAUSED_FLAG)) {
    des = des.substring(0, des.indexOf(SchedulerUtil.PAUSED_FLAG));
  }
  trigger.setDescription(des);
  model.addAttribute("trigger", trigger);
  return "editTrigger";
}

代码示例来源:origin: yejq/quartz-spring-manager

/**
 * 启动定时器 如果xml配置文件中的description中,是以$paused_flag
 * 结尾的,表示这个trigger是暂停状态,不需要resume. 其它的trigger全部resume.
 */
public static void startupScheduler(Scheduler scheduler) throws SchedulerException {
  scheduler.pauseAll();
  scheduler.start();
  String[] triggerGroups = scheduler.getTriggerGroupNames();
  for (int i = 0; i < triggerGroups.length; i++) {
    String[] triggersInGroup = scheduler.getTriggerNames(triggerGroups[i]);
    for (int j = 0; j < triggersInGroup.length; j++) {
      Trigger t = scheduler.getTrigger(triggersInGroup[j], triggerGroups[i]);
      if (t.getDescription() == null || !t.getDescription().endsWith(PAUSED_FLAG)) {
        scheduler.resumeTrigger(triggersInGroup[j], triggerGroups[i]);
      }
    }
  }
}

代码示例来源:origin: robeio/robe

public List<JobKey> getGeneralReport() throws SchedulerException {
  //TODO: sout is only for dev. Will change after deciding report
  List<JobKey> jobKeys = new LinkedList<>();
  for (String groupName : scheduler.getJobGroupNames()) {
    for (JobKey jobKey : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
      for (Trigger trigger : getTriggersOfJob(jobKey)) {
        StringBuilder builder = new StringBuilder();
        builder.append(jobKey.getGroup()).append(" ,");
        builder.append(jobKey.getName()).append(" ,");
        builder.append(trigger.getKey()).append(" ,");
        builder.append(trigger.getDescription()).append(" ,");
        builder.append(trigger.getStartTime()).append(" ,");
        builder.append(trigger.getEndTime()).append(" ,");
        builder.append(trigger.getPreviousFireTime()).append(" ,");
        builder.append(trigger.getNextFireTime()).append(" ,");
        builder.append(getTriggerStatus(trigger.getKey()).name());
        System.out.println(builder.toString());
      }
    }
  }
  return jobKeys;
}

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

private Object describe(final Trigger trigger) {
  if (trigger.getDescription() != null) {
   return trigger.getDescription();
  }
  if (trigger instanceof SimpleTrigger) {
   return "will fire every " + ((SimpleTrigger) trigger).getRepeatInterval() + "ms";
  }
  if (trigger instanceof CronTrigger) {
   return "will fire at " + ((CronTrigger) trigger).getCronExpression();
  }
  if (trigger instanceof CalendarIntervalTrigger) {
   CalendarIntervalTrigger calendar = (CalendarIntervalTrigger) trigger;
   return "will fire every " + calendar.getRepeatInterval() + " "
     + calendar.getRepeatIntervalUnit();
  }
  if (trigger instanceof DailyTimeIntervalTrigger) {
   DailyTimeIntervalTrigger daily = (DailyTimeIntervalTrigger) trigger;
   return "will fire every " + daily.getRepeatInterval() + " "
     + daily.getRepeatIntervalUnit();
  }
  return trigger;
 }
}

代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz

ps.setString(4, trigger.getJobGroup());
setBoolean(ps, 5, trigger.isVolatile());
ps.setString(6, trigger.getDescription());
ps.setBigDecimal(7, new BigDecimal(String.valueOf(trigger
    .getNextFireTime().getTime())));

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

ps.setString(4, trigger.getJobGroup());
setBoolean(ps, 5, trigger.isVolatile());
ps.setString(6, trigger.getDescription());
ps.setBigDecimal(7, new BigDecimal(String.valueOf(trigger
    .getNextFireTime().getTime())));

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

ps.setString(2, trigger.getJobGroup());
setBoolean(ps, 3, trigger.isVolatile());
ps.setString(4, trigger.getDescription());
long nextFireTime = -1;
if (trigger.getNextFireTime() != null) {

代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz

ps.setString(4, trigger.getJobGroup());
setBoolean(ps, 5, trigger.isVolatile());
ps.setString(6, trigger.getDescription());
if(trigger.getNextFireTime() != null)
  ps.setBigDecimal(7, new BigDecimal(String.valueOf(trigger

代码示例来源:origin: yejq/quartz-spring-manager

if (trigger instanceof CronTrigger) {
  String des = trigger.getDescription();
  if (des != null) {
    while (des.endsWith(SchedulerUtil.PAUSED_FLAG)) {

代码示例来源:origin: org.finra.herd/herd-service

"misfireInstruction: %s, nextFireTime: %s, previousFireTime: %s, priority: %s, startTime: %s", trigger.getCalendarName(), trigger.getDescription(),
trigger.getEndTime(), trigger.getFinalFireTime(), trigger.getJobKey(), trigger.getKey(), trigger.getMisfireInstruction(), trigger.getNextFireTime(),
trigger.getPreviousFireTime(), trigger.getPriority(), trigger.getStartTime()));

代码示例来源:origin: FINRAOS/herd

"misfireInstruction: %s, nextFireTime: %s, previousFireTime: %s, priority: %s, startTime: %s", trigger.getCalendarName(), trigger.getDescription(),
trigger.getEndTime(), trigger.getFinalFireTime(), trigger.getJobKey(), trigger.getKey(), trigger.getMisfireInstruction(), trigger.getNextFireTime(),
trigger.getPreviousFireTime(), trigger.getPriority(), trigger.getStartTime()));

代码示例来源:origin: net.sourceforge.kivu4j.job/kivu4j-job-services

public TriggerDto make(Trigger trigger) {
    int state = this.scheduleManager.getTriggerState(trigger.getName(),
        trigger.getGroup());
    TriggerDto dto = new TriggerDto(trigger.getJobName(),
        trigger.getJobGroup(),
        trigger.getName(),
        trigger.getGroup(),
        trigger.getFullName(),
        trigger.getDescription(), 
        ConvertUtil.convert(trigger.getNextFireTime(), String.class),
        state);    
    dto.setID(ConvertUtil.convert(trigger.getFullName().hashCode(), Long.class));
    return dto;
  }
}

代码示例来源:origin: nkcoder/quartz-explained

public static CompositeData toCompositeData(Trigger trigger) {
  try {
    return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
        new Object[] {
            trigger.getKey().getName(),
            trigger.getKey().getGroup(),
            trigger.getJobKey().getName(),
            trigger.getJobKey().getGroup(),
            trigger.getDescription(),
            JobDataMapSupport.toTabularData(trigger
                .getJobDataMap()),
            trigger.getCalendarName(),
            ((OperableTrigger)trigger).getFireInstanceId(),
            trigger.getMisfireInstruction(),
            trigger.getPriority(), trigger.getStartTime(),
            trigger.getEndTime(), trigger.getNextFireTime(),
            trigger.getPreviousFireTime(),
            trigger.getFinalFireTime() });
  } catch (OpenDataException e) {
    throw new RuntimeException(e);
  }
}

相关文章