in src/main/java/org/apache/sling/discovery/commons/providers/spi/base/OakBacklogClusterSyncService.java [143:178]
private void waitWhileBacklog(final BaseTopologyView view, final Runnable runnable) {
// start backgroundChecking until the backlogStatus
// is NO_BACKLOG
startBackgroundCheck("OakBacklogClusterSyncService-backlog-waiting-" + view.getLocalClusterSyncTokenId(), new BackgroundCheck() {
@Override
public boolean check() {
try {
if (!idMapService.isInitialized()) {
logSilencer.infoOrDebug("waitWhileBacklog-" + view.toShortString(),
"waitWhileBacklog: could not initialize...");
consistencyHistory.addHistoryEntry(view, "could not initialize idMapService");
return false;
}
} catch (Exception e) {
logger.error("waitWhileBacklog: could not initialized due to "+e, e);
consistencyHistory.addHistoryEntry(view, "got Exception while initializing idMapService ("+e+")");
return false;
}
BacklogStatus backlogStatus = getBacklogStatus(view);
if (backlogStatus == BacklogStatus.NO_BACKLOG) {
logSilencer.infoOrDebug("waitWhileBacklog-" + view.toShortString(),
"waitWhileBacklog: no backlog (anymore), done.");
consistencyHistory.addHistoryEntry(view, "no backlog (anymore)");
return true;
} else {
logSilencer.infoOrDebug("waitWhileBacklog-" + view.toShortString(),
"waitWhileBacklog: backlogStatus still "+backlogStatus);
// clear the cache to make sure to get the latest version in case something changed
idMapService.clearCache();
consistencyHistory.addHistoryEntry(view, "backlog status "+backlogStatus);
return false;
}
}
}, runnable, getCommonsConfig().getClusterSyncServiceTimeoutMillis(), getCommonsConfig().getClusterSyncServiceIntervalMillis());
}