in src/main/java/org/apache/sling/sitemap/impl/SitemapGeneratorExecutor.java [395:414]
protected boolean writePendingUrl() throws SitemapException {
boolean written = super.writePendingUrl();
if (written && ++writtenUrls == chunkSize) {
try {
// make sure the buffer has all data from the writer
out.flush();
// copy the state and add the buffer's data
Map<String, Object> copy = new HashMap<>(generatorContext.data.size() + 1);
copy.putAll(generatorContext.data);
copy.put(SitemapStorage.PN_SITEMAP_ENTRIES, urlCount);
copy.put(JcrConstants.JCR_DATA, buffer.copy());
// write the state and reset the counter for the next iteration
storage.writeState(sitemapRoot, name, copy);
writtenUrls = 0;
} catch (IOException ex) {
throw new SitemapException(ex);
}
}
return written;
}