コード例 #1
0
 /**
  * Check if the scheduler is stopped.
  *
  * @throws JobSchedulerException thrown if the scheduler status cannot be checked
  */
 public boolean isStopped() throws JobSchedulerException {
   try {
     return scheduler.isShutdown();
   } catch (SchedulerException e) {
     throw new JobSchedulerException(
         "An exception occurred during checking if the scheduler is stopped", e);
   }
 }
コード例 #2
0
ファイル: QuartzManage.java プロジェクト: hawkfly/srb
  public static void startJob(String jobName, Job job, String time)
      throws SchedulerException, ParseException {
    Scheduler sched = sf.getScheduler();

    JobDetail jobDetail = new JobDetail();
    jobDetail.setName(jobName);
    jobDetail.setGroup(JOB_GROUP_NAME);
    jobDetail.setJobClass(job.getClass());

    CronTrigger trigger = new CronTrigger(jobName, TRIGGER_GROUP_NAME);
    trigger.setCronExpression(time);
    sched.scheduleJob(jobDetail, trigger);

    if (!sched.isShutdown()) {
      sched.start();
    }
  }