in src/main/java/org/apache/sling/commons/scheduler/impl/WhiteboardHandler.java [210:234]
private boolean trySchedulePeriod(final ServiceReference<?> ref, final Object job) {
final Long period = getLongProperty(ref, Scheduler.PROPERTY_SCHEDULER_PERIOD);
if ( period == null ) {
return false;
}
if ( period < 1 ) {
this.logger.debug("Ignoring service {} : scheduler period is less than 1.", ref);
} else {
final Date date = new Date();
boolean immediate = getBooleanOrDefault(ref, Scheduler.PROPERTY_SCHEDULER_IMMEDIATE, false);
if ( !immediate ) {
date.setTime(System.currentTimeMillis() + period * 1000);
}
final Integer times = getIntegerProperty(ref, Scheduler.PROPERTY_SCHEDULER_TIMES);
if ( times != null && times < 1 ) {
this.logger.debug("Ignoring service {} : scheduler times is less than 1.", ref);
} else {
final int t = (times != null ? times : -1);
scheduleJob(ref, job, this.scheduler.AT(date, t, period));
return true;
}
}
return false;
}