in src/main/java/org/apache/sling/discovery/oak/SlingIdCleanupTask.java [366:397]
public void run() {
if (lastSuccessfulRun > 0 && System.currentTimeMillis()
- lastSuccessfulRun < minCleanupDelayMillis) {
logger.debug(
"run: last cleanup was {} millis ago, which is less than {} millis, therefore not cleaning up yet.",
System.currentTimeMillis() - lastSuccessfulRun,
minCleanupDelayMillis);
recreateSchedule();
return;
}
runCount.incrementAndGet();
if (!hasTopology) {
return;
}
boolean mightHaveMore = true;
try {
mightHaveMore = cleanup();
} catch (Exception e) {
// upon exception just log and retry in 10min
logger.error("run: got Exception while cleaning up slnigIds : " + e, e);
}
if (mightHaveMore) {
// then continue in 10min
recreateSchedule();
return;
}
// log successful cleanup done, yes, on info
logger.info(
"run: slingId cleanup done, run counter = {}, delete counter = {}, completion counter = {}",
getRunCount(), getDeleteCount(), getCompletionCount());
lastSuccessfulRun = System.currentTimeMillis();
}