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


Java TriggerUtils.makeSecondlyTrigger方法代码示例

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


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

示例1: makeIntervalTrigger

import org.quartz.TriggerUtils; //导入方法依赖的package包/类
private static final Trigger makeIntervalTrigger(String type, String interval,
    String repititions) throws ParseException {
  try {
    final int i = Integer.parseInt(interval);
    int r = SimpleTrigger.REPEAT_INDEFINITELY;
    if (!repititions.trim().equals("")) {
      r = Integer.parseInt(repititions);
    }
    if (type.equals(FREQUENCY_SECONDLY)) {
      return TriggerUtils.makeSecondlyTrigger(i, r);

    } else if (type.equals(FREQUENCY_MINUTELY)) {
      return TriggerUtils.makeMinutelyTrigger(i, r);

    } else if (type.equals(FREQUENCY_HOURLY)) {
      return TriggerUtils.makeHourlyTrigger(i, r);
    }
    return null;

  } catch (final NumberFormatException e) {
    throw new ParseException("Invalid interval or repitition value.", -1);
  }
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:24,代码来源:OBScheduler.java

示例2: run

import org.quartz.TriggerUtils; //导入方法依赖的package包/类
public void run() throws Exception {
    Logger log = Logger.getLogger(SimpleExample.class);

    log.info("------- Initializing ----------------------");

    // First we must get a reference to a scheduler
    SchedulerFactory sf = new StdSchedulerFactory();
    Scheduler sched = sf.getScheduler();

    log.info("------- Initialization Complete -----------");

    log.info("------- Scheduling Jobs -------------------");

    // computer a time that is on the next round minute
    Date runTime = TriggerUtils.getEvenMinuteDate(new Date());

    // define the job and tie it to our HelloJob class
    JobDetail job = new JobDetail("job1", "group1", HelloJob.class);
    JobDetail job1 = new JobDetail("job2", "group1", HelloJob.class);
    // Trigger the job to run on the next round minute
    Trigger trigger = TriggerUtils.makeSecondlyTrigger();
    trigger.setName("trigger");
    
    Trigger trigger1 = TriggerUtils.makeSecondlyTrigger();
    trigger1.setName("trigger1");
       // new SimpleTrigger("trigger1", "group1", runTime);
    
    // Tell quartz to schedule the job using our trigger
    sched.scheduleJob(job, trigger);
    sched.scheduleJob(job1,trigger1);
    log.info(job.getFullName() + " will run at: " + runTime);  

    // Start up the scheduler (nothing can actually run until the 
    // scheduler has been started)
    sched.start();
    log.info("------- Started Scheduler -----------------");

    // wait long enough so that the scheduler as an opportunity to 
    // run the job!
    log.info("------- Waiting 90 seconds... -------------");
    try {
        // wait 90 seconds to show jobs
        Thread.sleep(90L * 1000L); 
        // executing...
    } catch (Exception e) {
    }

    // shut down the scheduler
    log.info("------- Shutting Down ---------------------");
    sched.shutdown(true);
    log.info("------- Shutdown Complete -----------------");
}
 
开发者ID:xiangtao,项目名称:timeschedule,代码行数:53,代码来源:SimpleExample.java


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