org.quartz.Scheduler.start()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中org.quartz.Scheduler.start()方法的一些代码示例,展示了Scheduler.start()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.start()方法的具体详情如下:
包路径:org.quartz.Scheduler
类名称:Scheduler
方法名:start

Scheduler.start介绍

[英]Starts the Scheduler's threads that fire Triggers. When a scheduler is first created it is in "stand-by" mode, and will not fire triggers. The scheduler can also be put into stand-by mode by calling the standby() method.

The misfire/recovery process will be started, if it is the initial call to this method on this scheduler instance.
[中]

代码示例

代码示例来源:origin: azkaban/azkaban

public void start() {
 try {
  this.scheduler.start();
 } catch (final SchedulerException e) {
  logger.error("Error starting Quartz scheduler: ", e);
 }
 logger.info("Quartz Scheduler started.");
}

代码示例来源:origin: Netflix/Priam

public void start() {
    try {
      scheduler.start();
    } catch (SchedulerException ex) {
      throw new RuntimeException(ex);
    }
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Override
  public void run() {
    try {
      TimeUnit.SECONDS.sleep(startupDelay);
    }
    catch (InterruptedException ex) {
      Thread.currentThread().interrupt();
      // simply proceed
    }
    if (logger.isInfoEnabled()) {
      logger.info("Starting Quartz Scheduler now, after delay of " + startupDelay + " seconds");
    }
    try {
      scheduler.start();
    }
    catch (SchedulerException ex) {
      throw new SchedulingException("Could not start Quartz Scheduler after delay", ex);
    }
  }
};

代码示例来源:origin: spring-projects/spring-framework

if (startupDelay <= 0) {
  logger.info("Starting Quartz Scheduler now");
  scheduler.start();

代码示例来源:origin: jooby-project/jooby

@PostConstruct
public void start() throws Exception {
 for (Entry<JobDetail, Trigger> job : jobs) {
  JobDetail detail = job.getKey();
  Trigger trigger = job.getValue();
  log.info("  {} {}", detail.getKey(), describe(trigger));
  scheduler.scheduleJob(detail, trigger);
 }
 scheduler.start();
}

代码示例来源:origin: org.springframework/spring-context-support

@Override
  public void run() {
    try {
      TimeUnit.SECONDS.sleep(startupDelay);
    }
    catch (InterruptedException ex) {
      Thread.currentThread().interrupt();
      // simply proceed
    }
    if (logger.isInfoEnabled()) {
      logger.info("Starting Quartz Scheduler now, after delay of " + startupDelay + " seconds");
    }
    try {
      scheduler.start();
    }
    catch (SchedulerException ex) {
      throw new SchedulingException("Could not start Quartz Scheduler after delay", ex);
    }
  }
};

代码示例来源:origin: quartz-scheduler/quartz

public void serve(SchedulerFactory schedFact, boolean console)
  throws Exception {
  sched = schedFact.getScheduler();
  sched.start();
  try {
    Thread.sleep(3000l);
  } catch (Exception ignore) {
  }
  System.out.println("\n*** The scheduler successfully started.");
  if (console) {
    System.out.println("\n");
    System.out
        .println("The scheduler will now run until you type \"exit\"");
    System.out
        .println("   If it was configured to export itself via RMI,");
    System.out.println("   then other process may now use it.");
    BufferedReader rdr = new BufferedReader(new InputStreamReader(
        System.in));
    while (true) {
      System.out.print("Type 'exit' to shutdown the server: ");
      if ("exit".equals(rdr.readLine())) {
        break;
      }
    }
    System.out.println("\n...Shutting down server...");
    sched.shutdown(true);
  }
}

代码示例来源:origin: apache/incubator-gobblin

@Override protected void startUp() throws SchedulerException  {
 StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();
 if (this.quartzProps.isPresent() && this.quartzProps.get().size() > 0) {
  schedulerFactory.initialize(this.quartzProps.get());
 }
 this.scheduler = schedulerFactory.getScheduler();
 this.scheduler.start();
}

代码示例来源:origin: quartz-scheduler/quartz

public void serve(SchedulerFactory schedFact, boolean console)
  throws Exception {
  sched = schedFact.getScheduler();
  sched.start();
  try {
    Thread.sleep(3000l);
  } catch (Exception ignore) {
  }
  System.out.println("\n*** The scheduler successfully started.");
  if (console) {
    System.out.println("\n");
    System.out
        .println("The scheduler will now run until you type \"exit\"");
    System.out
        .println("   If it was configured to export itself via RMI,");
    System.out.println("   then other process may now use it.");
    BufferedReader rdr = new BufferedReader(new InputStreamReader(
        System.in));
    while (true) {
      System.out.print("Type 'exit' to shutdown the server: ");
      if ("exit".equals(rdr.readLine())) {
        break;
      }
    }
    System.out.println("\n...Shutting down server...");
    sched.shutdown(true);
  }
}

代码示例来源:origin: stackoverflow.com

CronScheduleBuilder.cronSchedule("0 0/1 * 1/1 * ? *")).startNow().build();
  scheduler.scheduleJob(jobDetail, trigger);
  scheduler.start();
} catch (Exception e) {
  ctx.log("There was an error scheduling the job.", e);

代码示例来源:origin: apache/shiro

scheduler.start();
if (log.isDebugEnabled()) {
  log.debug("Successfully started implicitly created Quartz Scheduler instance.");

代码示例来源:origin: quartz-scheduler/quartz

@Override
public void startService() throws Exception {
  log.info("Start QuartzService(" + jndiName + ")...");
  try {
    rebind();
  } catch (NamingException ne) {
    log.error("Failed to rebind Scheduler", ne);
    throw new SchedulerConfigException("Failed to rebind Scheduler - ",
        ne);
  }
  try {
    Scheduler scheduler = schedulerFactory.getScheduler();
    if (startScheduler) {
      scheduler.start();
    } else {
      log.info("Skipping starting the scheduler (will not run jobs).");
    }
  } catch (Exception e) {
    log.error("Failed to start Scheduler", e);
    throw new SchedulerConfigException("Failed to start Scheduler - ",
        e);
  }
  log.info("QuartzService(" + jndiName + ") started.");
}

代码示例来源:origin: quartz-scheduler/quartz

@Override
public void startService() throws Exception {
  log.info("Start QuartzService(" + jndiName + ")...");
  try {
    rebind();
  } catch (NamingException ne) {
    log.error("Failed to rebind Scheduler", ne);
    throw new SchedulerConfigException("Failed to rebind Scheduler - ",
        ne);
  }
  try {
    Scheduler scheduler = schedulerFactory.getScheduler();
    if (startScheduler) {
      scheduler.start();
    } else {
      log.info("Skipping starting the scheduler (will not run jobs).");
    }
  } catch (Exception e) {
    log.error("Failed to start Scheduler", e);
    throw new SchedulerConfigException("Failed to start Scheduler - ",
        e);
  }
  log.info("QuartzService(" + jndiName + ") started.");
}

代码示例来源:origin: elasticjob/elastic-job-lite

/**
 * 调度作业.
 * 
 * @param cron CRON表达式
 */
public void scheduleJob(final String cron) {
  try {
    if (!scheduler.checkExists(jobDetail.getKey())) {
      scheduler.scheduleJob(jobDetail, createTrigger(cron));
    }
    scheduler.start();
  } catch (final SchedulerException ex) {
    throw new JobSystemException(ex);
  }
}

代码示例来源:origin: Dreampie/Resty

sched.start();
Quartzer.addQuartzJob(this);

代码示例来源:origin: Dreampie/Resty

sched.start();
Quartzer.addQuartzJob(this);

代码示例来源:origin: Dreampie/Resty

public boolean start() {
 try {
  //加载配置文件
  Properties configProp = Proper.use(config).getProperties();
  //实例化
  Quartzer.setSchedulerFactory(new StdSchedulerFactory(configProp));
  //获取Scheduler
  Scheduler sched = Quartzer.getSchedulerFactory().getScheduler();
  //内存,数据库的任务
  sched.start();
  //属性文件中的任务
  startPropertiesJobs();
  return true;
 } catch (Exception e) {
  throw new QuartzException("Can't start quartz plugin.", e);
 }
}

代码示例来源:origin: changmingxie/tcc-transaction

public void init() {
  try {
    MethodInvokingJobDetailFactoryBean jobDetail = new MethodInvokingJobDetailFactoryBean();
    jobDetail.setTargetObject(transactionRecovery);
    jobDetail.setTargetMethod("startRecover");
    jobDetail.setName("transactionRecoveryJob");
    jobDetail.setConcurrent(false);
    jobDetail.afterPropertiesSet();
    CronTriggerFactoryBean cronTrigger = new CronTriggerFactoryBean();
    cronTrigger.setBeanName("transactionRecoveryCronTrigger");
    cronTrigger.setCronExpression(transactionConfigurator.getRecoverConfig().getCronExpression());
    cronTrigger.setJobDetail(jobDetail.getObject());
    cronTrigger.afterPropertiesSet();
    scheduler.scheduleJob(jobDetail.getObject(), cronTrigger.getObject());
    scheduler.start();
  } catch (Exception e) {
    throw new SystemException(e);
  }
}

代码示例来源:origin: spring-projects/spring-framework

verify(scheduler).start();
verify(scheduler).shutdown(false);

代码示例来源:origin: AxonFramework/AxonFramework

@Override
  public DeadlineManager buildDeadlineManager(Configuration configuration) {
    try {
      Scheduler scheduler = new StdSchedulerFactory().getScheduler();
      QuartzDeadlineManager quartzDeadlineManager =
          QuartzDeadlineManager.builder()
                     .scheduler(scheduler)
                     .scopeAwareProvider(new ConfigurationScopeAwareProvider(configuration))
                     .build();
      scheduler.start();
      return quartzDeadlineManager;
    } catch (SchedulerException e) {
      throw new AxonConfigurationException("Unable to configure quartz scheduler", e);
    }
  }
}

相关文章