in src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java [335:358]
private void recreateSchedule() {
final Scheduler localScheduler = scheduler;
if (localScheduler == null) {
// should not happen
logger.warn("recreateSchedule: no scheduler set, giving up.");
return;
}
final Calendar cal = Calendar.getInstance();
int delayMillis;
if (firstRun) {
delayMillis = initialDelayMillis;
} else {
delayMillis = intervalMillis;
}
cal.add(Calendar.MILLISECOND, delayMillis);
final Date scheduledDate = cal.getTime();
logger.info(
"recreateSchedule: scheduling a cleanup in {} milliseconds from now, which is: {}",
delayMillis, scheduledDate);
ScheduleOptions options = localScheduler.AT(scheduledDate);
options.name(SCHEDULE_NAME);
options.canRunConcurrently(false); // should not concurrently execute
localScheduler.schedule(this, options);
}