当前位置: 首页>>代码示例>>Java>>正文


Java ScheduleBuilder类代码示例

本文整理汇总了Java中org.quartz.ScheduleBuilder的典型用法代码示例。如果您正苦于以下问题:Java ScheduleBuilder类的具体用法?Java ScheduleBuilder怎么用?Java ScheduleBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScheduleBuilder类属于org.quartz包,在下文中一共展示了ScheduleBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTriggerPropertyBundle

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
@Override
protected TriggerPropertyBundle getTriggerPropertyBundle(SimplePropertiesTriggerProperties props) {

    TimeZone tz = null; // if we use null, that's ok as system default tz will be used
    String tzId = props.getString2();
    if(tzId != null && tzId.trim().length() != 0) // there could be null entries from previously released versions
        tz = TimeZone.getTimeZone(tzId);
    
    ScheduleBuilder<?> sb = CalendarIntervalScheduleBuilder.calendarIntervalSchedule()
        .withInterval(props.getInt1(), IntervalUnit.valueOf(props.getString1()))
        .inTimeZone(tz)
        .preserveHourOfDayAcrossDaylightSavings(props.isBoolean1())
        .skipDayIfHourDoesNotExist(props.isBoolean2());
    
    int timesTriggered = props.getInt2();
    
    String[] statePropertyNames = { "timesTriggered" };
    Object[] statePropertyValues = { timesTriggered };

    return new TriggerPropertyBundle(sb, statePropertyNames, statePropertyValues);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:CalendarIntervalTriggerPersistenceDelegate.java

示例2: getScheduleBuilder

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
/**
 * Get a {@link ScheduleBuilder} that is configured to produce a 
 * schedule identical to this trigger's schedule.
 * 
 * @see #getTriggerBuilder()
 */
@Override
public ScheduleBuilder<CronTrigger> getScheduleBuilder() {
    
    CronScheduleBuilder cb = CronScheduleBuilder.cronSchedule(getCronExpression())
            .inTimeZone(getTimeZone());
        
    switch(getMisfireInstruction()) {
        case MISFIRE_INSTRUCTION_DO_NOTHING : cb.withMisfireHandlingInstructionDoNothing();
        break;
        case MISFIRE_INSTRUCTION_FIRE_ONCE_NOW : cb.withMisfireHandlingInstructionFireAndProceed();
        break;
    }
    
    return cb;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:CronTriggerImpl.java

示例3: getScheduleBuilder

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
/**
 * Get a {@link ScheduleBuilder} that is configured to produce a 
 * schedule identical to this trigger's schedule.
 * 
 * @see #getTriggerBuilder()
 */
@Override
public ScheduleBuilder<DailyTimeIntervalTrigger> getScheduleBuilder() {
    
    DailyTimeIntervalScheduleBuilder cb = DailyTimeIntervalScheduleBuilder.dailyTimeIntervalSchedule()
            .withInterval(getRepeatInterval(), getRepeatIntervalUnit())
            .onDaysOfTheWeek(getDaysOfWeek()).startingDailyAt(getStartTimeOfDay()).endingDailyAt(getEndTimeOfDay());
        
    switch(getMisfireInstruction()) {
        case MISFIRE_INSTRUCTION_DO_NOTHING : cb.withMisfireHandlingInstructionDoNothing();
        break;
        case MISFIRE_INSTRUCTION_FIRE_ONCE_NOW : cb.withMisfireHandlingInstructionFireAndProceed();
        break;
    }
    
    return cb;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:DailyTimeIntervalTriggerImpl.java

示例4: getScheduleBuilder

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
/**
 * Get a {@link ScheduleBuilder} that is configured to produce a 
 * schedule identical to this trigger's schedule.
 * 
 * @see #getTriggerBuilder()
 */
@Override
public ScheduleBuilder<CalendarIntervalTrigger> getScheduleBuilder() {
    
    CalendarIntervalScheduleBuilder cb = CalendarIntervalScheduleBuilder.calendarIntervalSchedule()
            .withInterval(getRepeatInterval(), getRepeatIntervalUnit());
        
    switch(getMisfireInstruction()) {
        case MISFIRE_INSTRUCTION_DO_NOTHING : cb.withMisfireHandlingInstructionDoNothing();
        break;
        case MISFIRE_INSTRUCTION_FIRE_ONCE_NOW : cb.withMisfireHandlingInstructionFireAndProceed();
        break;
    }
    
    return cb;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:CalendarIntervalTriggerImpl.java

示例5: getScheduleBuilder

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
/**
 * Get a {@link ScheduleBuilder} that is configured to produce a 
 * schedule identical to this trigger's schedule.
 * 
 * @see #getTriggerBuilder()
 */
@Override
public ScheduleBuilder<SimpleTrigger> getScheduleBuilder() {
    
    SimpleScheduleBuilder sb = SimpleScheduleBuilder.simpleSchedule()
    .withIntervalInMilliseconds(getRepeatInterval())
    .withRepeatCount(getRepeatCount());
    
    switch(getMisfireInstruction()) {
        case MISFIRE_INSTRUCTION_FIRE_NOW : sb.withMisfireHandlingInstructionFireNow();
        break;
        case MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT : sb.withMisfireHandlingInstructionNextWithExistingCount();
        break;
        case MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT : sb.withMisfireHandlingInstructionNextWithRemainingCount();
        break;
        case MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT : sb.withMisfireHandlingInstructionNowWithExistingCount();
        break;
        case MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT : sb.withMisfireHandlingInstructionNowWithRemainingCount();
        break;
    }
    
    return sb;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:SimpleTriggerImpl.java

示例6: parseAtExpr

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
private ScheduleBuilder<? extends Trigger> parseAtExpr(String atExpr) {
    Matcher matcher = AT_EXPR_PATTERN.matcher(atExpr);
    if (!matcher.find()) {
        throwException(atExpr);
    }

    if (matcher.group(1).equals("??")) {
        String cronExpression = "0 " + matcher.group(2) + " * * * ?";
        return parseCron(cronExpression);
    }

    val formatter = DateTimeFormat.forPattern("HH:mm");
    val dateTime = formatter.parseDateTime(matcher.group().trim());

    int hourOfDay = dateTime.getHourOfDay();
    int minuteOfHour = dateTime.getMinuteOfHour();

    return dailyAtHourAndMinute(hourOfDay, minuteOfHour);
}
 
开发者ID:bingoohuang,项目名称:westcache,代码行数:20,代码来源:ScheduledParser.java

示例7: parseEveryExpr

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
private ScheduleBuilder<? extends Trigger> parseEveryExpr(String everyExpr) {
    Matcher matcher = EVERY_EXPR_PATTERN.matcher(everyExpr);
    if (!matcher.find())
        return throwException(everyExpr);

    int num = Integer.parseInt(matcher.group(1));
    if (num <= 0)
        throwException(everyExpr);

    char unit = matcher.group(2).charAt(0);
    TimeUnit timeUnit = parseTimeUnit(unit);

    return simpleSchedule()
            .withIntervalInSeconds((int) timeUnit.toSeconds(num))
            .repeatForever();
}
 
开发者ID:bingoohuang,项目名称:westcache,代码行数:17,代码来源:ScheduledParser.java

示例8: testAcquireNextTriggerAfterMissFire_doesNotTrigger_ifNextScheduleTimeOutOfRange

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
@Test
public void testAcquireNextTriggerAfterMissFire_doesNotTrigger_ifNextScheduleTimeOutOfRange()
  throws Exception {

  long baseFireTime = newDate().build().getTime();

  JobDetail job = JobBuilder.newJob(NoOpJob.class).build();
  jobStore.storeJob(job, true);

  ScheduleBuilder scheduleBuilder = simpleSchedule().withIntervalInSeconds(3).repeatForever()
      .withMisfireHandlingInstructionNextWithExistingCount();
  OperableTrigger t1 = buildAndComputeTrigger("trigger1", "triggerGroup1", job, baseFireTime + 500, null,
      scheduleBuilder);
  jobStore.storeTrigger(t1, false);

  assertAcquiredAndRelease(baseFireTime, 1);

  Thread.sleep(5000);
  // missed one execution (3 seconds tick is more than 1 seconds ago), next execution (at 6 seconds tick) is not yet picked up
  assertAcquiredAndRelease(newDate().build().getTime() + 250, 0);

  // try acquire on larger interval (containing 6 sec tick)
  assertAcquiredAndRelease(newDate().build().getTime() + 1550, 1);

}
 
开发者ID:FlavioF,项目名称:quartz-scheduler-hazelcast-jobstore,代码行数:26,代码来源:HazelcastJobStoreTest.java

示例9: buildTrigger

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
protected OperableTrigger buildTrigger(String triggerName,
    String triggerGroup,
    JobDetail job,
    Long startAt,
    Long endAt,
    ScheduleBuilder scheduleBuilder) {

  ScheduleBuilder schedule = scheduleBuilder!=null?scheduleBuilder : SimpleScheduleBuilder.simpleSchedule();
  return (OperableTrigger) TriggerBuilder
      .newTrigger()
      .withIdentity(triggerName, triggerGroup)
      .forJob(job)
      .startAt(startAt != null ? new Date(startAt) : null)
      .endAt(endAt != null ? new Date(endAt) : null)
      .withSchedule(schedule)
      .build();
}
 
开发者ID:FlavioF,项目名称:quartz-scheduler-hazelcast-jobstore,代码行数:18,代码来源:AbstractTest.java

示例10: scheduleRepeatingPeriodJob

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
private void scheduleRepeatingPeriodJob(RepeatingPeriodSchedulableJob job, boolean update) {
    logObjectIfNotNull(job);

    validateRepeatingPeriodSchedulableJob(job);

    MotechEvent motechEvent = job.getMotechEvent();

    JobId jobId = new RepeatingPeriodJobId(motechEvent);
    JobDetail jobDetail = newJob(MotechScheduledJob.class)
            .withIdentity(jobKey(jobId.value(), JOB_GROUP_NAME))
            .build();

    putMotechEventDataToJobDataMap(jobDetail.getJobDataMap(), motechEvent);

    jobDetail.getJobDataMap().put(EVENT_METADATA, createMetadataForMisfireSchedulableJob(job, motechEvent));

    ScheduleBuilder scheduleBuilder = PeriodIntervalScheduleBuilder.periodIntervalSchedule()
            .withRepeatPeriod(job.getRepeatPeriod())
            .withMisfireHandlingInstructionFireAndProceed();

    Trigger trigger = buildJobDetail(job, DateUtil.toDate(job.getStartDate()),
            DateUtil.toDate(job.getEndDate()), jobId, jobDetail, scheduleBuilder);
    scheduleJob(jobDetail, trigger, update);
}
 
开发者ID:motech,项目名称:motech,代码行数:25,代码来源:MotechSchedulerServiceImpl.java

示例11: getScheduleBuilder

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
/**
 * Get a {@link ScheduleBuilder} that is configured to produce a
 * schedule identical to this trigger's schedule.
 *
 * @see #getTriggerBuilder()
 */
@Override
public ScheduleBuilder<PeriodIntervalTrigger> getScheduleBuilder() {

    PeriodIntervalScheduleBuilder sb = PeriodIntervalScheduleBuilder.periodIntervalSchedule()
            .withRepeatPeriod(repeatPeriod)
            .withMisfireHandlingInstructionDoNothing();


    switch (getMisfireInstruction()) {
        case MISFIRE_INSTRUCTION_DO_NOTHING :
            sb.withMisfireHandlingInstructionDoNothing();
            break;
        case MISFIRE_INSTRUCTION_FIRE_ONCE_NOW :
            sb.withMisfireHandlingInstructionFireAndProceed();
            break;
    }

    return sb;
}
 
开发者ID:motech,项目名称:motech,代码行数:26,代码来源:PeriodIntervalTriggerImpl.java

示例12: scheduleRepeatingJob

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
@Override
public void scheduleRepeatingJob(long interval) {
    Date jobStartTime = DateUtil.nowUTC().toDate();

    if (interval == 0) {
        throw new IllegalArgumentException("Invalid RepeatingSchedulableJob. The job repeat interval can not be 0");
    }

    JobDetail jobDetail = newJob(MdsScheduledJob.class)
            .withIdentity(jobKey(EMPTY_TRASH_JOB, JOB_GROUP_NAME))
            .build();

    ScheduleBuilder scheduleBuilder = simpleSchedule()
            .withIntervalInMilliseconds(interval)
            .withRepeatCount(MAX_REPEAT_COUNT);

    Trigger trigger = buildJobDetail(jobStartTime, jobDetail, scheduleBuilder);
    scheduleJob(jobDetail, trigger);
}
 
开发者ID:motech,项目名称:motech,代码行数:20,代码来源:MdsSchedulerServiceImpl.java

示例13: schedule

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
private static Scheduled schedule( Runnable runnable, ScheduleBuilder<?> scheduleBuilder ) {
    try {
        String identity = identity( runnable );

        JobDetail job = newJob( RunnableJob.class )
            .withIdentity( identity + "/job" )
            .storeDurably()
            .build();

        Trigger trigger = newTrigger()
            .withIdentity( identity + "/trigger" )
            .withSchedule( scheduleBuilder )
            .build();

        jobFactory.register( job, runnable );

        scheduler.scheduleJob( job, trigger );
        log.trace( "scheduling job {} with trigger {}", job, trigger );
        return new QuartzScheduled( job );
    } catch( org.quartz.SchedulerException e ) {
        throw new SchedulerException( e );
    }
}
 
开发者ID:oaplatform,项目名称:oap,代码行数:24,代码来源:Scheduler.java

示例14: createScheduleBuilder

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
private ScheduleBuilder<? extends Trigger> createScheduleBuilder() {
    if (StringUtils.startsWithIgnoreCase(schedulerExpr, "Every")) {
        return parseEveryExpr(schedulerExpr.substring("Every".length()));
    } else if (StringUtils.startsWithIgnoreCase(schedulerExpr, "At")) {
        return parseAtExpr(schedulerExpr.substring("At".length()));
    } else {
        return parseCron(schedulerExpr);
    }
}
 
开发者ID:bingoohuang,项目名称:westcache,代码行数:10,代码来源:ScheduledParser.java

示例15: getScheduleBuilder

import org.quartz.ScheduleBuilder; //导入依赖的package包/类
@Override
@JsonIgnore
public ScheduleBuilder getScheduleBuilder() {
    return new ScheduleBuilder<SimpleTrigger>() {
        @Override
        protected MutableTrigger build() {
            return SimpleScheduleBuilder.simpleSchedule()
                    .withRepeatCount(repeatCount)
                    .withIntervalInMilliseconds(repeatInterval)
                    .withMisfireHandlingInstructionNextWithRemainingCount()
                    .build();
        }
    };
}
 
开发者ID:Netflix,项目名称:Fenzo,代码行数:15,代码来源:IntervalTrigger.java


注:本文中的org.quartz.ScheduleBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。