protected void storeLastDistributedOffset()

in src/main/java/org/apache/sling/distribution/journal/impl/publisher/PackageDistributedNotifier.java [120:135]


    protected void storeLastDistributedOffset() {
        for (Map.Entry<String, LocalStore> localStoreEntry: localStores.entrySet()) {
            String pubAgentName = localStoreEntry.getKey();
            LocalStore localStore = localStoreEntry.getValue();
            long lastDistributedOffset = lastDistributedOffsets.getOrDefault(pubAgentName, Long.MAX_VALUE);
            long lastStoredOffset = localStore.load(STORE_TYPE_OFFSETS, Long.MAX_VALUE);
            if (lastDistributedOffset != lastStoredOffset) {
                try {
                    localStore.store(STORE_TYPE_OFFSETS, lastDistributedOffset);
                    LOG.info("The offset={} has been stored for the pubAgentName={}", lastDistributedOffset, pubAgentName);
                } catch (Exception  e) {
                    LOG.warn("Exception when storing the last distributed offset in the repository", e);
                }
            }
        }
    }