Package org.quartz

Examples of org.quartz.SimpleScheduleBuilder


            return new InternalScheduleOptions(new IllegalArgumentException("Times argument must be higher than 1 or -1"));
        }
        if ( period < 1 ) {
            return new InternalScheduleOptions(new IllegalArgumentException("Period argument must be higher than 0"));
        }
        final SimpleScheduleBuilder sb;
        if ( times == -1 ) {
            sb = SimpleScheduleBuilder.simpleSchedule().repeatForever();
        } else {
            sb = SimpleScheduleBuilder.simpleSchedule().withRepeatCount(times - 1);
        }
        return new InternalScheduleOptions( TriggerBuilder.newTrigger()
            .startNow()
            .withSchedule(sb.withIntervalInMilliseconds(period * 1000)));
    }
View Full Code Here


        }
        if ( period < 1 ) {
            return new InternalScheduleOptions(new IllegalArgumentException("Period argument must be higher than 0"));
        }

        final SimpleScheduleBuilder sb;
        if ( times == -1 ) {
            sb = SimpleScheduleBuilder.simpleSchedule().repeatForever();
        } else {
            sb = SimpleScheduleBuilder.simpleSchedule().withRepeatCount(times - 1);
        }
        return new InternalScheduleOptions( TriggerBuilder.newTrigger()
            .startAt(date)
            .withSchedule(sb.withIntervalInMilliseconds(period * 1000)));
    }
View Full Code Here

   * @param timeUnit the time unit
   * @param timeInterval the time interval
   * @return the simple trigger
   */
  private Trigger getSimpleTrigger(TimeUnit timeUnit, int timeInterval) {
    SimpleScheduleBuilder simpleScheduleBuilder = null;
    simpleScheduleBuilder = SimpleScheduleBuilder.simpleSchedule();

    switch (timeUnit) {
    case MILLISECONDS:
      simpleScheduleBuilder.withIntervalInMilliseconds(timeInterval).repeatForever();
      break;
    case SECONDS:
      simpleScheduleBuilder.withIntervalInSeconds(timeInterval).repeatForever();
      break;
    case MINUTES:
      simpleScheduleBuilder.withIntervalInMinutes(timeInterval).repeatForever();
      break;
    case HOURS:
      simpleScheduleBuilder.withIntervalInHours(timeInterval).repeatForever();
      break;
    case DAYS:
      simpleScheduleBuilder.withIntervalInHours(timeInterval * 24).repeatForever();
      break;
    default:
      throw new RuntimeException("The " + RelativeOutputSchedule.class.getSimpleName() + " cannot handle a time unit of " + timeUnit); //default 1 sec
    }
    Trigger simpleTrigger = TriggerBuilder.newTrigger().withSchedule(simpleScheduleBuilder).build();
View Full Code Here

     * @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;
    }
View Full Code Here

            if (rs.next()) {
                int repeatCount = rs.getInt(COL_REPEAT_COUNT);
                long repeatInterval = rs.getLong(COL_REPEAT_INTERVAL);
                int timesTriggered = rs.getInt(COL_TIMES_TRIGGERED);

                SimpleScheduleBuilder sb = SimpleScheduleBuilder.simpleSchedule()
                    .withRepeatCount(repeatCount)
                    .withIntervalInMilliseconds(repeatInterval);
               
                String[] statePropertyNames = { "timesTriggered" };
                Object[] statePropertyValues = { timesTriggered };
View Full Code Here

                throw new IllegalArgumentException("Times argument must be higher than 1 or -1");
            }
            if (period < 1) {
                throw new IllegalArgumentException("Period argument must be higher than 0");
            }
            final SimpleScheduleBuilder sb;
            if (times == -1) {
                sb = SimpleScheduleBuilder.simpleSchedule().repeatForever();
            } else {
                sb = SimpleScheduleBuilder.simpleSchedule().withRepeatCount(times - 1);
            }
            trigger = TriggerBuilder.newTrigger()
                        .startAt(date)
                        .withSchedule(sb.withIntervalInMilliseconds(period * 1000));
        } catch (IllegalArgumentException e) {
            argumentException = e;
        }
        this.trigger = trigger;
        this.argumentException = argumentException;
View Full Code Here

TOP

Related Classes of org.quartz.SimpleScheduleBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.