JobDetail注意事项

  JobDetail jobDetail2 = JobBuilder.newJob(TestDetail.class).withIdentity("111", "555").storeDurably().build();//添加job不带触发器必须写storeDurably()否则报如下异常,durable指明任务就算没有绑定Trigger仍保留在Quartz的JobStore中
  scheduler.addJob(jobDetail, true);

Exception in thread "main" org.quartz.SchedulerException: Jobs added with no trigger must be durable.

 triggerJob(JobKey jobKey)   Trigger the identified JobDetail (execute it now).创建一个立即触发的Trigger,并将其与name与group指定的任务绑定

创建JobDetail不写 withIdentity("111", "555"),则显示如下分组名称

DEFAULT.6da64b5bd2ee-7df01501-213c-4bae-b508-7041115e442e

猜你喜欢

转载自www.cnblogs.com/blob-liuh/p/9806374.html