Java Code Examples for org.quartz.CronScheduleBuilder#cronSchedule()

The following examples show how to use org.quartz.CronScheduleBuilder#cronSchedule() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuartzExecutor.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public void incur(ITaskService taskService, ITaskDescriptor taskDescriptor) throws TaskException{
	
	// test if the runnable can be instantiated
	taskService.instantiateRunnableById(taskDescriptor.getIdentifiedRunnableId());
	
	String cron = taskDescriptor.getTriggerParameters().get("cron");
	CronScheduleBuilder cronSchedule = CronScheduleBuilder.cronSchedule(cron);
	
	JobKey jobKey = new JobKey(taskDescriptor.getId());
	JobDataMap jobDataMap = new JobDataMap(taskDescriptor.getRunContext());
	jobDataMap.put("taskDescriptor", taskDescriptor);
	jobDataMap.put("taskService", taskService);
	
	JobDetail jobDetail = JobBuilder.newJob(TriggerTaskJob.class).withIdentity(jobKey).build();
	Trigger trigger = TriggerBuilder.newTrigger().withIdentity(taskDescriptor.getId())
		.withSchedule(cronSchedule).usingJobData(jobDataMap).build();
	
	try {
		sched.scheduleJob(jobDetail, trigger);
	} catch (SchedulerException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
}
 
Example 2
Source File: CronService.java    From aion-germany with GNU General Public License v3.0 6 votes vote down vote up
public void schedule(Runnable r, String cronExpression, boolean longRunning) {
	try {
		JobDataMap jdm = new JobDataMap();
		jdm.put(RunnableRunner.KEY_RUNNABLE_OBJECT, r);
		jdm.put(RunnableRunner.KEY_PROPERTY_IS_LONGRUNNING_TASK, longRunning);
		jdm.put(RunnableRunner.KEY_CRON_EXPRESSION, cronExpression);

		String jobId = "Started at ms" + System.currentTimeMillis() + "; ns" + System.nanoTime();
		JobKey jobKey = new JobKey("JobKey:" + jobId);
		JobDetail jobDetail = JobBuilder.newJob(runnableRunner).usingJobData(jdm).withIdentity(jobKey).build();

		CronScheduleBuilder csb = CronScheduleBuilder.cronSchedule(cronExpression);
		CronTrigger trigger = TriggerBuilder.newTrigger().withSchedule(csb).build();

		scheduler.scheduleJob(jobDetail, trigger);
	} catch (Exception e) {
		throw new CronServiceException("Failed to start job", e);
	}
}
 
Example 3
Source File: ScheduleJobService.java    From springboot-quartz with MIT License 6 votes vote down vote up
private void addJob(ScheduleJob scheduleJob) throws Exception{  
  	checkNotNull(scheduleJob);
Preconditions.checkNotNull(StringUtils.isEmpty(scheduleJob.getCronExpression()), "CronExpression is null");

      TriggerKey triggerKey = TriggerKey.triggerKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());  
      CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);  
      if(trigger != null){  
          throw new Exception("job already exists!");  
      }
      
      // simulate job info db persist operation
      scheduleJob.setJobId(String.valueOf(QuartzJobFactory.jobList.size()+1));
      QuartzJobFactory.jobList.add(scheduleJob);
      
      JobDetail jobDetail = JobBuilder.newJob(QuartzJobFactory.class).withIdentity(scheduleJob.getJobName(),scheduleJob.getJobGroup()).build();  
      jobDetail.getJobDataMap().put("scheduleJob", scheduleJob);  

      CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression());  
      trigger = TriggerBuilder.newTrigger().withIdentity(scheduleJob.getJobName(), scheduleJob.getJobGroup()).withSchedule(cronScheduleBuilder).build();  

      scheduler.scheduleJob(jobDetail, trigger);  

  }
 
Example 4
Source File: ScheduleUtils.java    From LuckyFrameWeb with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * 创建定时任务
 */
public static void createScheduleJob(Scheduler scheduler, Job job)
{
    try
    {
        // 构建job信息
        JobDetail jobDetail = JobBuilder.newJob(ScheduleJob.class).withIdentity(getJobKey(job.getJobId())).build();

        // 表达式调度构建器
        CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression());
        cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder);

        // 按新的cronExpression表达式构建一个新的trigger
        CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(job.getJobId())).withSchedule(cronScheduleBuilder).build();

        // 放入参数,运行时的方法可以获取
        jobDetail.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job);

        scheduler.scheduleJob(jobDetail, trigger);

        // 暂停任务
        if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue()))
        {
            pauseJob(scheduler, job.getJobId());
        }
    }
    catch (SchedulerException | TaskException e)
    {
        log.error("createScheduleJob 异常:", e);
    }
}
 
Example 5
Source File: MonitorScheduler.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@PostConstruct
public void scheduleMonitors() throws SchedulerException {
    for (Monitor<?> monitor : monitorList) {
        LOGGER.debug("Monitor sceduled: {}, id: {}, cron: {}", monitor.getClass(), monitor.getIdentifier(), monitor.getTriggerExpression());
        JobDataMap jobDataMap = new JobDataMap();
        jobDataMap.put(MonitorContext.APPLICATION_CONTEXT.name(), applicationContext);
        JobDetail jobDetail = newJob(monitor.getClass()).withIdentity(monitor.getIdentifier()).setJobData(jobDataMap).build();
        CronScheduleBuilder cronBuilder = CronScheduleBuilder.cronSchedule(monitor.getTriggerExpression());
        Trigger trigger = newTrigger().startNow().withSchedule(cronBuilder).build();
        scheduler.scheduleJob(jobDetail, trigger);
    }
}
 
Example 6
Source File: JobStoreImplTest.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Simulate a job that has run longer than the next fire time such that it misfires.
 */
@Test
public void testTriggerPastDueMisfire() throws Exception {
  JobDetail jobDetail = JobBuilder.newJob(MyNonConcurrentJob.class)
      .storeDurably(true)
      .build();
  jobStore.storeJob(jobDetail, false);

  ZoneId zone = ZoneId.systemDefault();

  Date baseFireTimeDate = DateBuilder.evenMinuteDateAfterNow();
  LocalDateTime baseDateTime = LocalDateTime.ofInstant(baseFireTimeDate.toInstant(), zone);
  LocalDateTime startAt = baseDateTime.minusMinutes(5);
  LocalDateTime nextFireTime = startAt.plusMinutes(1);

  CronScheduleBuilder schedule = CronScheduleBuilder.cronSchedule("0 1 * * * ? *");
  OperableTrigger trigger = (OperableTrigger) TriggerBuilder.newTrigger()
      .forJob(jobDetail)
      .withSchedule(schedule)
      .startAt(Date.from(startAt.atZone(zone).toInstant()))
      .build();

  // misfire the trigger and set the next fire time in the past
  trigger.updateAfterMisfire(null);
  trigger.setNextFireTime(Date.from(nextFireTime.atZone(zone).toInstant()));
  jobStore.storeTrigger(trigger, false);

  List<OperableTrigger> acquiredTriggers =
      jobStore.acquireNextTriggers(DateBuilder.evenMinuteDateAfterNow().getTime(), 4, 1000L);
  assertEquals(1, acquiredTriggers.size());
}
 
Example 7
Source File: ScheduleJobService.java    From springboot-quartz with MIT License 5 votes vote down vote up
private void updateJobCronExpression(ScheduleJob scheduleJob) throws SchedulerException{  
checkNotNull(scheduleJob);
Preconditions.checkNotNull(StringUtils.isEmpty(scheduleJob.getCronExpression()), "CronExpression is null");

      TriggerKey triggerKey = TriggerKey.triggerKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());  
      CronTrigger cronTrigger = (CronTrigger)scheduler.getTrigger(triggerKey);  
      CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression());  
      cronTrigger = cronTrigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build();  
      scheduler.rescheduleJob(triggerKey, cronTrigger);  
  }
 
Example 8
Source File: CronTriggerPersistenceDelegate.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public TriggerPropertyBundle loadExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException {

        PreparedStatement ps = null;
        ResultSet rs = null;
        
        try {
            ps = conn.prepareStatement(Util.rtp(SELECT_CRON_TRIGGER, tablePrefix, schedNameLiteral));
            ps.setString(1, triggerKey.getName());
            ps.setString(2, triggerKey.getGroup());
            rs = ps.executeQuery();

            if (rs.next()) {
                String cronExpr = rs.getString(COL_CRON_EXPRESSION);
                String timeZoneId = rs.getString(COL_TIME_ZONE_ID);

                CronScheduleBuilder cb = CronScheduleBuilder.cronSchedule(cronExpr);
              
                if (timeZoneId != null) 
                    cb.inTimeZone(TimeZone.getTimeZone(timeZoneId));
                
                return new TriggerPropertyBundle(cb, null, null);
            }
            
            throw new IllegalStateException("No record found for selection of Trigger with key: '" + triggerKey + "' and statement: " + Util.rtp(SELECT_CRON_TRIGGER, tablePrefix, schedNameLiteral));
        } finally {
            Util.closeResultSet(rs);
            Util.closeStatement(ps);
        }
    }
 
Example 9
Source File: ScheduleJobService.java    From frameworkAggregate with Apache License 2.0 5 votes vote down vote up
/**
 * 更新job时间表达式
 * 
 * @param scheduleJob
 * @throws SchedulerException
 */
public void updateJobCron(ScheduleJob scheduleJob) throws SchedulerException {
	Scheduler scheduler = schedulerFactoryBean.getScheduler();
	TriggerKey triggerKey = TriggerKey.triggerKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
	CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);
	CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression());
	trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
	scheduler.rescheduleJob(triggerKey, trigger);
}
 
Example 10
Source File: CallMonitor.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Reset the connection to fbox periodically.
 */
public void setupReconnectJob() {
    try {
        // String cronPattern = "0 0 0 * * ?"; //every day
        // String cronPattern = "0 * * * * ?"; //every minute
        String cronPattern = "0 0 0/2 * * ?"; // every 2 hrs
        Scheduler sched = StdSchedulerFactory.getDefaultScheduler();

        JobKey jobKey = jobKey("Reconnect", "FritzBox");
        TriggerKey triggerKey = triggerKey("Reconnect", "FritzBox");

        if (sched.checkExists(jobKey)) {
            logger.debug("reconnection job already exists");
        } else {
            CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(cronPattern);

            JobDetail job = newJob(ReconnectJob.class).withIdentity(jobKey).build();

            CronTrigger trigger = newTrigger().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();

            sched.scheduleJob(job, trigger);
            logger.debug("Scheduled reconnection job to FritzBox: {}", cronPattern);
        }
    } catch (SchedulerException e) {
        logger.warn("Could not create daily reconnection job", e);
    }
}
 
Example 11
Source File: ScheduleUtils.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 创建定时任务
 */
public static void createScheduleJob(Scheduler scheduler, SysJob job) throws SchedulerException, TaskException
{
    Class<? extends Job> jobClass = getQuartzJobClass(job);
    // 构建job信息
    Long jobId = job.getJobId();
    String jobGroup = job.getJobGroup();
    JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(getJobKey(jobId, jobGroup)).build();

    // 表达式调度构建器
    CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression());
    cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder);

    // 按新的cronExpression表达式构建一个新的trigger
    CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(jobId, jobGroup))
            .withSchedule(cronScheduleBuilder).build();

    // 放入参数,运行时的方法可以获取
    jobDetail.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job);

    // 判断是否存在
    if (scheduler.checkExists(getJobKey(jobId, jobGroup)))
    {
        // 防止创建时存在数据问题 先移除,然后在执行创建操作
        scheduler.deleteJob(getJobKey(jobId, jobGroup));
    }

    scheduler.scheduleJob(jobDetail, trigger);

    // 暂停任务
    if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue()))
    {
        scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup));
    }
}
 
Example 12
Source File: CronSchedulerJobManger.java    From springbootexamples with Apache License 2.0 5 votes vote down vote up
private void scheduleJob2(Scheduler scheduler) throws SchedulerException{
    JobDetail jobDetail = JobBuilder.newJob(CronJob2.class) .withIdentity("job2", "group2")
    		.usingJobData("serviceCode","Live lesson reminder2").build();
    CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule("0/10 * * * * ?");
    CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity("trigger2", "group2") .withSchedule(scheduleBuilder).build();
    scheduler.scheduleJob(jobDetail,cronTrigger);  
}
 
Example 13
Source File: CronSchedulerJobManger.java    From springbootexamples with Apache License 2.0 5 votes vote down vote up
private void scheduleJob(Scheduler scheduler) throws SchedulerException{
    JobDetail jobDetail = JobBuilder.newJob(CronJob.class) .withIdentity("job1", "group1")
    		.usingJobData("serviceCode","Live lesson reminder1").build();
    CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule("0/5 * * * * ?");
    CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity("trigger1", "group1") .withSchedule(scheduleBuilder).build();
    scheduler.scheduleJob(jobDetail,cronTrigger);   
}
 
Example 14
Source File: JobTrigger.java    From spring-cloud-shop with MIT License 5 votes vote down vote up
/**
 * 更新定时任务
 *
 * @param scheduler      the scheduler
 * @param jobName        the job name
 * @param jobGroup       the job group
 * @param cronExpression the cron expression
 * @param param          the param
 */
private static void updateJob(Scheduler scheduler, String jobName, String jobGroup, String cronExpression, Object param) throws SchedulerException {

    // 同步或异步
    Class<? extends Job> jobClass = JobQuartzJobBean.class;
    JobDetail jobDetail = scheduler.getJobDetail(getJobKey(jobName, jobGroup));

    jobDetail = jobDetail.getJobBuilder().ofType(jobClass).build();

    // 更新参数 实际测试中发现无法更新
    JobDataMap jobDataMap = jobDetail.getJobDataMap();
    jobDataMap.put("JobAdapter", param);
    jobDetail.getJobBuilder().usingJobData(jobDataMap);

    TriggerKey triggerKey = getTriggerKey(jobName, jobGroup);

    // 表达式调度构建器
    CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression);

    CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);

    // 按新的cronExpression表达式重新构建trigger
    trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
    Trigger.TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
    // 忽略状态为PAUSED的任务,解决集群环境中在其他机器设置定时任务为PAUSED状态后,集群环境启动另一台主机时定时任务全被唤醒的bug
    if (!JobEnums.PAUSE.name().equalsIgnoreCase(triggerState.name())) {
        // 按新的trigger重新设置job执行
        scheduler.rescheduleJob(triggerKey, trigger);
    }
}
 
Example 15
Source File: JobTrigger.java    From spring-cloud-shop with MIT License 5 votes vote down vote up
/**
 * 创建任务
 *
 * @param scheduler scheduler
 * @param job       job
 * @param params    params
 */
public static void createJob(Scheduler scheduler, JobInfo job, Map<String, Object> params) throws SchedulerException {
    Class<? extends Job> jobClass = JobQuartzJobBean.class;

    // 构建job信息
    JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(job.getJobName(), job.getJobGroup()).build();
    // 表达式调度构建器
    CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCron());
    // 按新的cron表达式构建一个新的trigger
    Trigger trigger = TriggerBuilder.newTrigger().withIdentity(job.getJobName(), job.getJobGroup())
            .withSchedule(scheduleBuilder).build();

    scheduler.scheduleJob(jobDetail, trigger);
}
 
Example 16
Source File: TriggerUtil.java    From spring-batch-rest with Apache License 2.0 4 votes vote down vote up
public static Trigger triggerFor(String cronExpression, String jobName, String groupName) {
	CronScheduleBuilder builder = CronScheduleBuilder.cronSchedule(cronExpression);
	return newTrigger().withIdentity(jobName, groupName).withSchedule(builder).forJob(jobName, groupName).build();
}
 
Example 17
Source File: TaskInnerServiceSMOImpl.java    From MicroCommunity with Apache License 2.0 4 votes vote down vote up
/**
 * 启动任务
 *
 * @param taskDto
 * @return
 */
public int startTask(@RequestBody TaskDto taskDto) {
    List<TaskAttrDto> attrDtos = BeanConvertUtil.covertBeanList(taskAttrServiceDaoImpl.getTaskAttrInfo(BeanConvertUtil.beanCovertMap(taskDto)),
            TaskAttrDto.class);
    Map info = new HashMap();
    info.put("templateId", taskDto.getTemplateId());
    List<TaskTemplateDto> taskTemplateDtos = BeanConvertUtil.covertBeanList(taskServiceDaoImpl.getTaskTemplateInfo(info), TaskTemplateDto.class);

    Assert.listOnlyOne(taskTemplateDtos, "模板不存在或存在多个");

    taskDto.setTaskTemplateDto(taskTemplateDtos.get(0));
    taskDto.setTaskAttr(attrDtos);

    try {
        String cronExpression = taskDto.getTaskCron();// 如果没有配置则,每一分运行一次

        CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression);

        String jobName = prefixJobName + taskDto.getTaskId();

        String triggerName = triggerNames + taskDto.getTaskId();

        //设置任务名称
        JobKey jobKey = new JobKey(jobName, TaskSystemJob.JOB_GROUP_NAME);
        JobDetail jobDetail = scheduler.getJobDetail(jobKey);

        if (jobDetail != null) {
            return 0;
        }

        String taskCfgName = taskDto.getTaskName();
        JobDetail warnJob = JobBuilder.newJob(TaskSystemJob.class).withIdentity(jobName, TaskSystemJob.JOB_GROUP_NAME).withDescription("任务启动").build();

        warnJob.getJobDataMap().put(TaskSystemJob.JOB_DATA_CONFIG_NAME, taskCfgName);

        warnJob.getJobDataMap().put(TaskSystemJob.JOB_DATA_TASK_ID, taskDto.getTaskId());
        warnJob.getJobDataMap().put(TaskSystemJob.JOB_DATA_TASK, taskDto);
        warnJob.getJobDataMap().put(TaskSystemJob.JOB_DATA_TASK_ATTR, taskDto);

        // 触发时间点
        CronTrigger warnTrigger = TriggerBuilder.newTrigger().withIdentity(triggerName, triggerName + "_group").withSchedule(cronScheduleBuilder).build();

        // 错过执行后,立即执行
        //warnTrigger(CronTrigger.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW);
        //交由Scheduler安排触发
        scheduler.scheduleJob(warnJob, warnTrigger);
        Map paramIn = new HashMap();
        paramIn.put("taskId", taskDto.getTaskId());
        paramIn.put("state", "002");
        paramIn.put("statusCd", "0");
        taskServiceDaoImpl.updateTaskInfoInstance(paramIn);

    } catch (Exception e) {
        logger.error("启动侦听失败", e);
        return 0;
    }
    return 1;
}
 
Example 18
Source File: QuartzTriggerConverter.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Helper to build a cron-schedule.
 */
private CronScheduleBuilder cron(final Date date, final String patternSuffix) {
  return CronScheduleBuilder.cronSchedule(cronTimeParts(date) + " " + patternSuffix);
}
 
Example 19
Source File: FritzboxBinding.java    From openhab1-addons with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
@SuppressWarnings("rawtypes")
public void updated(Dictionary config) throws ConfigurationException {

    if (config != null) {
        String ip = Objects.toString(config.get("ip"), null);
        if (StringUtils.isNotBlank(ip)) {
            if (!ip.equals(FritzboxBinding.ip)) {
                // only do something if the ip has changed
                FritzboxBinding.ip = ip;
                conditionalDeActivate();

                // schedule a daily reconnection as sometimes the FritzBox
                // stops sending data
                // and thus blocks the monitor thread
                try {
                    Scheduler sched = StdSchedulerFactory.getDefaultScheduler();

                    JobKey jobKey = jobKey("Reconnect", "FritzBox");
                    TriggerKey triggerKey = triggerKey("Reconnect", "FritzBox");

                    if (sched.checkExists(jobKey)) {
                        logger.debug("Daily reconnection job already exists");
                    } else {
                        CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(cronSchedule);

                        JobDetail job = newJob(ReconnectJob.class).withIdentity(jobKey).build();

                        CronTrigger trigger = newTrigger().withIdentity(triggerKey).withSchedule(scheduleBuilder)
                                .build();

                        sched.scheduleJob(job, trigger);
                        logger.debug("Scheduled a daily reconnection to FritzBox on {}:{}", ip, MONITOR_PORT);
                    }
                } catch (SchedulerException e) {
                    logger.warn("Could not create daily reconnection job", e);
                }
            }
        }
        String password = Objects.toString(config.get("password"), null);
        if (StringUtils.isNotBlank(password)) {
            FritzboxBinding.password = password;
        }

        String username = Objects.toString(config.get("user"), null);
        if (StringUtils.isNotBlank(username)) {
            FritzboxBinding.username = username;
        }
    }
}
 
Example 20
Source File: AbstractQuartzTaskManager.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
private CronScheduleBuilder getCronScheduleBuilder(TaskInfo.TriggerInfo triggerInfo) throws TaskException {
    CronScheduleBuilder cb = CronScheduleBuilder.cronSchedule(triggerInfo.getCronExpression());
    cb = this.handleCronScheduleMisfirePolicy(triggerInfo, cb);
    return cb;
}