Any relation between Quartz API and Joda Time API?

前端 未结 4 971
傲寒
傲寒 2021-02-15 09:34

Is it possible to create a date in JodaTime and then make Quartz schedule the job using the JodaTime object? Can we give a Period jodaPeriod to Quartz API in order to run a task

4条回答
  •  南旧
    南旧 (楼主)
    2021-02-15 10:05

    TriggerBuilder has a snippet of how to schedule a job by hand:

    JobDetail job = newJob(MyJob.class)
             .withIdentity("myJob")
             .build();
    
    Trigger trigger = newTrigger() 
             .withIdentity(triggerKey("myTrigger", "myTriggerGroup"))
             .withSchedule(simpleSchedule()
                 .withIntervalInHours(1)
                 .repeatForever())
             .startAt(futureDate(10, MINUTES))
             .build();
    
    scheduler.scheduleJob(job, trigger);
    

    You will have to do some conversion work for the startAt() and the withIntervalInHours()...you get the drift

提交回复
热议问题