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


Java SimpleScheduleBuilder.simpleSchedule方法代码示例

本文整理汇总了Java中org.quartz.SimpleScheduleBuilder.simpleSchedule方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleScheduleBuilder.simpleSchedule方法的具体用法?Java SimpleScheduleBuilder.simpleSchedule怎么用?Java SimpleScheduleBuilder.simpleSchedule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.quartz.SimpleScheduleBuilder的用法示例。


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

示例1: convert

import org.quartz.SimpleScheduleBuilder; //导入方法依赖的package包/类
@Override
public Trigger convert(Immediate trigger) {
    SimpleScheduleBuilder simpleSchedule = SimpleScheduleBuilder.simpleSchedule();
    if (trigger.getMisfireInstruction() == Immediate.MisfireInstruction.DROP) {
        simpleSchedule = simpleSchedule.withMisfireHandlingInstructionIgnoreMisfires();
    } else if (trigger.getMisfireInstruction() == Immediate.MisfireInstruction.FIRE_NOW) {
        simpleSchedule = simpleSchedule.withMisfireHandlingInstructionFireNow();
    }
    return newTrigger()
            .withIdentity(trigger.getTriggerKey().getName(), trigger.getTriggerKey().getGroup())
            .forJob(trigger.getJobKey().getName(), trigger.getJobKey().getGroup())
            .withDescription(trigger.getDescription())
            .withSchedule(simpleSchedule)
            .usingJobData(new JobDataMap(trigger.getTriggerData()))
            .startNow()
            .build();
}
 
开发者ID:taboola,项目名称:taboola-cronyx,代码行数:18,代码来源:ImmediateConverter.java

示例2: createRepeatingTask

import org.quartz.SimpleScheduleBuilder; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static TaskBase createRepeatingTask(@Nonnull Class<? extends TaskCallback> commandClass,
        long interval, long initialDelay) {
    checkCommandClass(commandClass, false);

    Class<QuartzCommand> quartzCommand = (Class<QuartzCommand>) commandClass;
    JobDetail jobDetail = JobBuilder.newJob(quartzCommand).withIdentity(generateUniqueName(quartzCommand),
            QuartzTask.ARTIFACTORY_GROUP).build();

    SimpleScheduleBuilder schedulerBuilder = SimpleScheduleBuilder.simpleSchedule();
    if (interval > 0) {
        schedulerBuilder.repeatForever().withIntervalInMilliseconds(interval);
    }
    Trigger trigger = TriggerBuilder.newTrigger().forJob(jobDetail)
            .withIdentity(generateUniqueName(quartzCommand))
            .withSchedule(schedulerBuilder).startAt(new Date(System.currentTimeMillis() + initialDelay)).build();

    return fillProperties(QuartzTask.createQuartzTask(commandClass, trigger, jobDetail), false);
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:20,代码来源:TaskUtils.java

示例3: buildTrigger

import org.quartz.SimpleScheduleBuilder; //导入方法依赖的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

示例4: addSchedule

import org.quartz.SimpleScheduleBuilder; //导入方法依赖的package包/类
/**
 * 增加一个调度任务
 * 
 * @param name
 *            任务名称
 * @param job
 *            执行内容
 * @param intervalInHours
 *            间隔小时
 * @param intervalInMinutes
 *            间隔分钟
 * @param intervalInSeconds
 *            间隔秒
 * @param intervalInMillis
 *            间隔毫秒
 * @param repeatCount
 *            重复次数
 * @throws SchedulerException
 */
public Trigger addSchedule(String name, Class<? extends Job> task, int intervalInHours, int intervalInMinutes,
		int intervalInSeconds, int intervalInMillis, int repeatCount, JobDataMap param) throws SchedulerException {
	Scheduler sched = SF.getScheduler();
	JobBuilder builder = JobBuilder.newJob(task);
	builder.withIdentity(name, Scheduler.DEFAULT_GROUP);
	if (param != null) {
		builder.usingJobData(param);
	}
	SimpleScheduleBuilder simpleSchedule = SimpleScheduleBuilder.simpleSchedule();
	if (intervalInHours > 0) {
		simpleSchedule.withIntervalInHours(intervalInHours);
	}
	if (intervalInMinutes > 0) {
		simpleSchedule.withIntervalInMinutes(intervalInMinutes);
	}
	if (intervalInSeconds > 0) {
		simpleSchedule.withIntervalInSeconds(intervalInSeconds);
	}
	if (intervalInMillis > 0) {
		simpleSchedule.withIntervalInMilliseconds(intervalInMillis);
	}
	if (repeatCount >= 0) {
		simpleSchedule.withRepeatCount(repeatCount);
	} else {
		simpleSchedule.repeatForever();
	}
	Trigger trigger = TriggerBuilder.newTrigger().withIdentity(name, Scheduler.DEFAULT_GROUP)
			.withSchedule(simpleSchedule).build();
	sched.scheduleJob(builder.build(), trigger);
	if (!sched.isShutdown())
		sched.start();
	return trigger;
}
 
开发者ID:HankXV,项目名称:Limitart,代码行数:53,代码来源:SchedulerUtil.java

示例5: start

import org.quartz.SimpleScheduleBuilder; //导入方法依赖的package包/类
public void start() throws SchedulerException {
    
    JobDetail job = JobBuilder.newJob(ScheduleExecutor.class)
              .withIdentity(jobname, "group1")
              .requestRecovery()
              .usingJobData("configPath", configPath)
              .usingJobData("logDirectory", logDirectory)
              .build();
    
    // schedule
    int timeInterval = 1;
    SimpleScheduleBuilder simpleScheduleBuilder = null;
    simpleScheduleBuilder = SimpleScheduleBuilder.simpleSchedule();
    simpleScheduleBuilder.withIntervalInHours(timeInterval * 24).repeatForever();
    
    Trigger trigger = TriggerBuilder
            .newTrigger()
            .withIdentity(triggername, "group1")
            .withSchedule(simpleScheduleBuilder)
            .startAt(DateBuilder.dateOf(23, 55, 0))
            .forJob(job)
            .build();
    
    scheduler = new StdSchedulerFactory(configPath+"config/quartz.properties").getScheduler();
    scheduler.start();
    scheduler.scheduleJob(job, trigger);
    
}
 
开发者ID:mikkeliamk,项目名称:osa,代码行数:29,代码来源:TaskScheduler.java

示例6: testStoreAndRetriveTriggers

import org.quartz.SimpleScheduleBuilder; //导入方法依赖的package包/类
@Test()
public void testStoreAndRetriveTriggers() throws Exception {
  SchedulerSignaler schedSignaler = new SampleSignaler();
  ClassLoadHelper loadHelper = new CascadingClassLoadHelper();
  loadHelper.initialize();

  JobStore store = createJobStore("testStoreAndRetriveTriggers");
  store.initialize(loadHelper, schedSignaler);

  // Store jobs and triggers.
  for (int i = 0; i < 10; i++) {
    JobDetail job = JobBuilder.newJob(NoOpJob.class).withIdentity("job" + i)
        .build();
    store.storeJob(job, true);
    SimpleScheduleBuilder schedule = SimpleScheduleBuilder.simpleSchedule();
    Trigger trigger = TriggerBuilder.newTrigger().withIdentity("job" + i)
        .withSchedule(schedule).forJob(job).build();
    store.storeTrigger((OperableTrigger) trigger, true);
  }
  // Retrieve job and trigger.
  for (int i = 0; i < 10; i++) {
    JobKey jobKey = JobKey.jobKey("job" + i);
    JobDetail storedJob = store.retrieveJob(jobKey);
    Assert.assertEquals(jobKey, storedJob.getKey());

    TriggerKey triggerKey = TriggerKey.triggerKey("job" + i);
    Trigger storedTrigger = store.retrieveTrigger(triggerKey);
    Assert.assertEquals(triggerKey, storedTrigger.getKey());
  }
}
 
开发者ID:Ameausoone,项目名称:quartz-hazelcast-jobstore,代码行数:31,代码来源:TestHazelcastJobStore.java

示例7: buildTrigger

import org.quartz.SimpleScheduleBuilder; //导入方法依赖的package包/类
/**
 * @return build Trigger with specified name and group, unattached to a job.
 */
protected Trigger buildTrigger(String triggerName, String groupName) {
  SimpleScheduleBuilder schedule = SimpleScheduleBuilder.simpleSchedule();
  Trigger trigger = TriggerBuilder.newTrigger()
      .withIdentity(triggerName, groupName).withSchedule(schedule).build();
  return (Trigger) trigger;
}
 
开发者ID:Ameausoone,项目名称:quartz-hazelcast-jobstore,代码行数:10,代码来源:AbstractTestHazelcastJobStore.java

示例8: createTrigger

import org.quartz.SimpleScheduleBuilder; //导入方法依赖的package包/类
protected Trigger createTrigger(JobDataMap data, Date start, int interval,
		int repeat, Date end) {

	TriggerBuilder<Trigger> triggerBuilder = TriggerBuilder.newTrigger();

	if (data != null) {
		triggerBuilder.usingJobData(data);
	}
	if (interval > 0) {
		SimpleScheduleBuilder schedule = SimpleScheduleBuilder
				.simpleSchedule();
		schedule.withIntervalInMilliseconds(interval).withRepeatCount(
				repeat);
		triggerBuilder.withSchedule(schedule);
	}

	if (start != null) {
		triggerBuilder.startAt(start);
	} else {
		triggerBuilder.startNow();
	}

	if (end != null) {
		triggerBuilder.endAt(end);
	}

	return triggerBuilder.build();
}
 
开发者ID:ludup,项目名称:hypersocket-framework,代码行数:29,代码来源:SchedulerServiceImpl.java

示例9: setTriggerParam

import org.quartz.SimpleScheduleBuilder; //导入方法依赖的package包/类
/**
 * 设置trigger
 *
 * @param job
 * @param triggerKey
 * @param trigger
 * @param triggerBuilder
 */
public Trigger setTriggerParam(ScheduleJob job, TriggerKey triggerKey, TriggerBuilder triggerBuilder,
                               Trigger trigger) {
    if (job.getTriggerType().equals("CronTrigger")) {
        CronScheduleBuilder cronBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression());
        // 按新的cronExpression表达式构建一个新的trigger
        if (job.getStartTime() != null)
            triggerBuilder.startAt(job.getStartTime());
        if (job.getEndTime() != null)
            triggerBuilder.endAt(job.getEndTime());
        //int index=job.getDesc().indexOf(";repeatType:")>-1?job.getDesc().indexOf(";repeatType:"):job.getDesc().length();
        trigger = triggerBuilder.withIdentity(triggerKey).withSchedule(cronBuilder).withDescription(
                job.getDesc()).build();
    } else if (job.getTriggerType().equals("SimpleTrigger")) {
        SimpleScheduleBuilder simpleBuilder = SimpleScheduleBuilder.simpleSchedule();
        if (job.getStartTime() != null)
            triggerBuilder.startAt(job.getStartTime());
        if (job.getEndTime() != null)
            triggerBuilder.endAt(job.getEndTime());
        if (StrUtil.isNotBlank(job.getRepeatType())) {
            if (job.getRepeatType().equals("repeatForever")) {
                simpleBuilder=simpleBuilderForever(simpleBuilder,job);

            }
            else if (job.getRepeatType().equals("repeatHourlyForever")) {
                if (job.getRepeatInterval() != null)
                    simpleBuilder = simpleBuilder.repeatHourlyForever(job.getRepeatInterval());
                else
                    simpleBuilder = simpleBuilder.repeatHourlyForever();
            } else if (job.getRepeatType().equals("repeatMinutelyForever")) {
                if (job.getRepeatInterval() != null)
                    simpleBuilder = simpleBuilder.repeatMinutelyForever(job.getRepeatInterval());
                else
                    simpleBuilder = simpleBuilder.repeatMinutelyForever();
            } else if (job.getRepeatType().equals("repeatSecondlyForever")) {
                if (job.getRepeatInterval() != null)
                    simpleBuilder = simpleBuilder.repeatSecondlyForever(job.getRepeatInterval());
                else
                    simpleBuilder = simpleBuilder.repeatSecondlyForever();
            } else if (job.getRepeatType().equals("repeatHourlyForTotalCount")) {
                if (job.getRepeatCount() != null && job.getRepeatInterval() != null)
                    simpleBuilder = simpleBuilder.repeatHourlyForTotalCount(job.getRepeatCount(), job
                            .getRepeatInterval());
                else if (job.getRepeatCount() != null)
                    simpleBuilder = simpleBuilder.repeatHourlyForTotalCount(job.getRepeatCount());
            } else if (job.getRepeatType().equals("repeatMinutelyForTotalCount")) {
                if (job.getRepeatCount() != null && job.getRepeatInterval() != null)
                    simpleBuilder = simpleBuilder.repeatMinutelyForTotalCount(job.getRepeatCount(), job
                            .getRepeatInterval());
                else if (job.getRepeatCount() != null)
                    simpleBuilder = simpleBuilder.repeatMinutelyForTotalCount(job.getRepeatCount());
            } else if (job.getRepeatType().equals("repeatSecondlyForTotalCount")) {
                if (job.getRepeatCount() != null && job.getRepeatInterval() != null)
                    simpleBuilder = simpleBuilder.repeatSecondlyForTotalCount(job.getRepeatCount(), job
                            .getRepeatInterval());
                else if (job.getRepeatCount() != null)
                    simpleBuilder = simpleBuilder.repeatSecondlyForTotalCount(job.getRepeatCount());
            }
        }
        if(StrUtil.isEmpty(job.getDesc()))
            job.setDesc("");
        int index=job.getDesc().indexOf(";repeatType:")>-1?job.getDesc().indexOf(";repeatType:"):job.getDesc().length();
        trigger = triggerBuilder.withIdentity(triggerKey).withSchedule(simpleBuilder).withDescription(
                job.getDesc().substring(0,index) + ";repeatType:" + job.getRepeatType()).build();
        /*trigger = triggerBuilder.withIdentity(triggerKey).withSchedule(simpleBuilder).withDescription(
                job.getDesc()).build();*/
    }
    return trigger;
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:77,代码来源:JobServiceImpl.java

示例10: testMatchers

import org.quartz.SimpleScheduleBuilder; //导入方法依赖的package包/类
@Test
public void testMatchers() throws Exception {
  JobDetail job = JobBuilder.newJob(MyJob.class).withIdentity("job1", "aaabbbccc").build();
  jobStore.storeJob(job, true);
  SimpleScheduleBuilder schedule = SimpleScheduleBuilder.simpleSchedule();
  Trigger trigger = TriggerBuilder.newTrigger().withIdentity("trig1", "aaabbbccc").withSchedule(schedule).forJob(job)
      .build();
  jobStore.storeTrigger((OperableTrigger) trigger, true);

  job = JobBuilder.newJob(MyJob.class).withIdentity("job1", "xxxyyyzzz").build();
  jobStore.storeJob(job, true);
  schedule = SimpleScheduleBuilder.simpleSchedule();
  trigger = TriggerBuilder.newTrigger().withIdentity("trig1", "xxxyyyzzz").withSchedule(schedule).forJob(job).build();
  jobStore.storeTrigger((OperableTrigger) trigger, true);

  job = JobBuilder.newJob(MyJob.class).withIdentity("job2", "xxxyyyzzz").build();
  jobStore.storeJob(job, true);
  schedule = SimpleScheduleBuilder.simpleSchedule();
  trigger = TriggerBuilder.newTrigger().withIdentity("trig2", "xxxyyyzzz").withSchedule(schedule).forJob(job).build();
  jobStore.storeTrigger((OperableTrigger) trigger, true);

  Set<JobKey> jkeys = jobStore.getJobKeys(GroupMatcher.anyJobGroup());
  assertEquals("Wrong number of jobs found by anything matcher", 3, jkeys.size());

  jkeys = jobStore.getJobKeys(GroupMatcher.jobGroupEquals("xxxyyyzzz"));
  assertEquals("Wrong number of jobs found by equals matcher", 2, jkeys.size());

  jkeys = jobStore.getJobKeys(GroupMatcher.jobGroupEquals("aaabbbccc"));
  assertEquals("Wrong number of jobs found by equals matcher", 1, jkeys.size());

  jkeys = jobStore.getJobKeys(GroupMatcher.jobGroupStartsWith("aa"));
  assertEquals("Wrong number of jobs found by starts with matcher", 1, jkeys.size());

  jkeys = jobStore.getJobKeys(GroupMatcher.jobGroupStartsWith("xx"));
  assertEquals("Wrong number of jobs found by starts with matcher", 2, jkeys.size());

  jkeys = jobStore.getJobKeys(GroupMatcher.jobGroupEndsWith("cc"));
  assertEquals("Wrong number of jobs found by ends with matcher", 1, jkeys.size());

  jkeys = jobStore.getJobKeys(GroupMatcher.jobGroupEndsWith("zzz"));
  assertEquals("Wrong number of jobs found by ends with matcher", 2, jkeys.size());

  jkeys = jobStore.getJobKeys(GroupMatcher.jobGroupContains("bc"));
  assertEquals("Wrong number of jobs found by contains with matcher", 1, jkeys.size());

  jkeys = jobStore.getJobKeys(GroupMatcher.jobGroupContains("yz"));
  assertEquals("Wrong number of jobs found by contains with matcher", 2, jkeys.size());

  Set<TriggerKey> tkeys = jobStore.getTriggerKeys(GroupMatcher.anyTriggerGroup());
  assertEquals("Wrong number of triggers found by anything matcher", 3, tkeys.size());

  tkeys = jobStore.getTriggerKeys(GroupMatcher.triggerGroupEquals("xxxyyyzzz"));
  assertEquals("Wrong number of triggers found by equals matcher", 2, tkeys.size());

  tkeys = jobStore.getTriggerKeys(GroupMatcher.triggerGroupEquals("aaabbbccc"));
  assertEquals("Wrong number of triggers found by equals matcher", 1, tkeys.size());

  tkeys = jobStore.getTriggerKeys(GroupMatcher.triggerGroupStartsWith("aa"));
  assertEquals("Wrong number of triggers found by starts with matcher", 1, tkeys.size());

  tkeys = jobStore.getTriggerKeys(GroupMatcher.triggerGroupStartsWith("xx"));
  assertEquals("Wrong number of triggers found by starts with matcher", 2, tkeys.size());

  tkeys = jobStore.getTriggerKeys(GroupMatcher.triggerGroupEndsWith("cc"));
  assertEquals("Wrong number of triggers found by ends with matcher", 1, tkeys.size());

  tkeys = jobStore.getTriggerKeys(GroupMatcher.triggerGroupEndsWith("zzz"));
  assertEquals("Wrong number of triggers found by ends with matcher", 2, tkeys.size());

  tkeys = jobStore.getTriggerKeys(GroupMatcher.triggerGroupContains("bc"));
  assertEquals("Wrong number of triggers found by contains with matcher", 1, tkeys.size());

  tkeys = jobStore.getTriggerKeys(GroupMatcher.triggerGroupContains("yz"));
  assertEquals("Wrong number of triggers found by contains with matcher", 2, tkeys.size());
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:76,代码来源:JobStoreImplTest.java

示例11: buildTrigger

import org.quartz.SimpleScheduleBuilder; //导入方法依赖的package包/类
private Trigger buildTrigger(String name, String group, ScheduleRule scheduleRule) {
    Trigger trigger;

    Parameters triggerParameters = scheduleRule.getTriggerParameters();
    Integer triggerStartDelaySeconds = triggerParameters.getInt(TriggerParameters.startDelaySeconds);
    int intTriggerStartDelaySeconds = (triggerStartDelaySeconds != null) ? triggerStartDelaySeconds : 0;

    Date firstFireTime;
    if (startDelaySeconds > 0 || (triggerStartDelaySeconds != null && triggerStartDelaySeconds > 0)) {
        firstFireTime = new Date(System.currentTimeMillis() + ((startDelaySeconds + intTriggerStartDelaySeconds) * 1000L));
    } else {
        firstFireTime = new Date();
    }

    if (scheduleRule.getTriggerType() == TriggerType.SIMPLE) {
        Long intervalInMilliseconds = triggerParameters.getLong(TriggerParameters.intervalInMilliseconds);
        Integer intervalInSeconds = triggerParameters.getInt(TriggerParameters.intervalInSeconds);
        Integer intervalInMinutes = triggerParameters.getInt(TriggerParameters.intervalInMinutes);
        Integer intervalInHours = triggerParameters.getInt(TriggerParameters.intervalInHours);
        Integer repeatCount = triggerParameters.getInt(TriggerParameters.repeatCount);
        Boolean repeatForever = triggerParameters.getBoolean(TriggerParameters.repeatForever);

        SimpleScheduleBuilder builder = SimpleScheduleBuilder.simpleSchedule();

        if (intervalInMilliseconds != null) {
            builder.withIntervalInMilliseconds(intervalInMilliseconds);
        }
        if (intervalInMinutes != null) {
            builder.withIntervalInMinutes(intervalInMinutes);
        }
        if (intervalInSeconds != null) {
            builder.withIntervalInSeconds(intervalInSeconds);
        }
        if (intervalInHours != null) {
            builder.withIntervalInHours(intervalInHours);
        }
        if (repeatCount != null) {
            builder.withRepeatCount(repeatCount);
        }
        if (Boolean.TRUE.equals(repeatForever)) {
            builder.repeatForever();
        }

        trigger = TriggerBuilder.newTrigger()
                .withIdentity(name, group)
                .startAt(firstFireTime)
                .withSchedule(builder)
                .build();
    } else {
        String expression = triggerParameters.getString(TriggerParameters.expression);
        CronScheduleBuilder cronSchedule = CronScheduleBuilder.cronSchedule(expression);

        trigger = TriggerBuilder.newTrigger()
                .withIdentity(name, group)
                .startAt(firstFireTime)
                .withSchedule(cronSchedule)
                .build();
    }

    return trigger;
}
 
开发者ID:aspectran,项目名称:aspectran,代码行数:62,代码来源:QuartzSchedulerService.java

示例12: configureTriggerJob

import org.quartz.SimpleScheduleBuilder; //导入方法依赖的package包/类
private Trigger configureTriggerJob(String jobName, String jobGroup, Job job) {
 TriggerBuilder<Trigger> triggerBuilder = TriggerBuilder.newTrigger();
 		 
 // base trigger configuration 
 triggerBuilder.withIdentity(jobName, jobGroup);
 
 if (job.getStartTime() != null)
	 triggerBuilder.startAt(job.getStartTime());
 else {
	 if (job.getActive())
		 triggerBuilder.startNow();
 }

 if (job.getEndTime() != null)
	 triggerBuilder.endAt(job.getEndTime());		 
	 
 triggerBuilder.withPriority(job.getJobTriggerPriority());
 
 // propietary trigger configuration
 if (job.getJobTriggerType().getCode().equals(Job.JOB_TRIGGER_TYPE.SIMPLE.name())) {
	 SimpleScheduleBuilder simpleScheduleBuilder = SimpleScheduleBuilder.simpleSchedule();
	 
	 if (job.getJobInterval() != null) {
		 if (job.getJobIntervalType().getCode().equals(Job.JOB_INTERVAL_TYPE.SECOND.name()))
			 simpleScheduleBuilder.withIntervalInSeconds(job.getJobInterval());
		 else if (job.getJobIntervalType().getCode().equals(Job.JOB_INTERVAL_TYPE.MINUTE.name()))
			 simpleScheduleBuilder.withIntervalInMinutes(job.getJobInterval());
		 else if (job.getJobIntervalType().getCode().equals(Job.JOB_INTERVAL_TYPE.HOUR.name()))
			 simpleScheduleBuilder.withIntervalInHours(job.getJobInterval());
		 else if (job.getJobIntervalType().getCode().equals(Job.JOB_INTERVAL_TYPE.DAY.name()))
			 simpleScheduleBuilder.withIntervalInHours(job.getJobInterval() * 24);
		 else if (job.getJobIntervalType().getCode().equals(Job.JOB_INTERVAL_TYPE.WEEK.name()))
			 simpleScheduleBuilder.withIntervalInHours(job.getJobInterval() * 24 * 7);
	 }
	
	 if (job.getRepeatCount() != null)
		 simpleScheduleBuilder.withRepeatCount(job.getRepeatCount());
	 else
		 simpleScheduleBuilder.repeatForever();
	 
     triggerBuilder.withSchedule(simpleScheduleBuilder);
		 
 }
 else if (job.getJobTriggerType().getCode().equals(Job.JOB_TRIGGER_TYPE.CRON.name())) {
	 CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression());
	 
	 triggerBuilder.withSchedule(cronScheduleBuilder);
 }
 						 
 return triggerBuilder.build();
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:52,代码来源:JobManagerServiceImpl.java


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