in src/main/java/org/apache/sling/distribution/journal/bookkeeper/BookKeeper.java [240:263]
private void failure(PackageMessage pkgMsg, long offset, Exception e) throws DistributionException {
distributionMetricsService.getFailedPackageImports().mark();
String pubAgentName = pkgMsg.getPubAgentName();
int retries = packageRetries.get(pubAgentName);
boolean giveUp = errorQueueEnabled && retries >= config.getMaxRetries();
String retriesSt = errorQueueEnabled ? Integer.toString(config.getMaxRetries()) : "infinite";
String action = giveUp ? "skip the package" : "retry later";
String msg = format("Failed attempt (%s/%s) to import the distribution package %s at offset=%d because of '%s', the importer will %s", retries, retriesSt, pkgMsg, offset, e.getMessage(), action);
try {
LogMessage logMessage = getLogMessage(pubAgentName, msg, e);
logSender.accept(logMessage);
} catch (Exception e2) {
log.warn("Error sending log message", e2);
};
if (giveUp) {
log.warn(msg, e);
removeFailedPackage(pkgMsg, offset);
distributionMetricsService.getPermanentImportErrors().increment();
} else {
packageRetries.increase(pubAgentName);
throw new DistributionException(msg, e);
}
}