How to implement a quasi-stationary failure strategy?

Currently, my quartz quest starts as follows:

  • At the first task schedule, the task will be launched after 5 minutes.
  • The task will run 5 times, with an interval of 2 minutes.

So, if I plan my work in time1, reference will be made in time1 + 5, time1 + 7, time1 + 9, time1 + 11,time1 + 13

  private org.quartz.Trigger makeTrigger() {
    org.quartz.ScheduleBuilder<org.quartz.SimpleTrigger> scheduleBuilder =
        org.quartz.SimpleScheduleBuilder.simpleSchedule()
            .withIntervalInMilliseconds(intervalMillis)
            .withRepeatCount(repeatCount);

    return org.quartz.TriggerBuilder.newTrigger()
        .withIdentity(key.getLeft(), key.getRight())
        .usingJobData(new org.quartz.JobDataMap(jobData))
        .startAt(dateTimeHelper.toStandardDate(startDateTime))
        .withSchedule(scheduleBuilder)
        .build();
  }

But I need the work to be less aggressive, so my question is how to tune triggers to exponential time intervals? So after I plan to work in time1, the task will be performed at: time1 + 5, time1 + 7, time1 + 11, time1 + 19, time1 + 35?

Do I have to reschedule the task every time the task is completed?

+4

Source: https://habr.com/ru/post/1672512/


All Articles