Spring + Quartz resheduling or updating the trigger?

后端 未结 1 1418
伪装坚强ぢ
伪装坚强ぢ 2021-01-14 21:54

I am using Spring 3.2 and Quartz 2.2.

My target Class and method,

public class Producer {

    pu         


        
相关标签:
1条回答
  • 2021-01-14 22:38

    Try one of the following:

    Trigger newTrigger = tb.withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(2)).build();
    

    or

    Trigger newTrigger = tb.withSchedule(SimpleScheduleBuilder.repeatSecondlyForever(2)).build();
    

    Both are syntactically valid. It looks like your issue with Trigger newTrigger = tb.withSchedule(simpleSchedule().withIntervalInSeconds(triggerInSec).build()); is caused by incorrect bracketing. ie build() should not have an extra bracket after it, as it returns a trigger.

    0 讨论(0)
提交回复
热议问题