void persist()

in src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java [478:498]


    void persist(ResourceResolver resolver, Pipe pipe, ExecutionResult result, Resource currentResource) throws PersistenceException, InterruptedException {
        if (shouldSave(resolver, pipe, result, currentResource)) {
            log.info("[{}] saving changes...", pipe.getName());
            writeStatus(pipe, currentResource == null ? STATUS_FINISHED : currentResource.getPath(), result);
            resolver.commit();
            if (currentResource == null && distributor != null && StringUtils.isNotBlank(pipe.getDistributionAgent())) {
                log.info("a distribution agent is configured, will try to distribute the changes");
                DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.ADD, true, result.getCurrentPathSet().toArray(new String[result.getCurrentPathSet().size()]));
                DistributionResponse response = distributor.distribute(pipe.getDistributionAgent(), resolver, request);
                log.info("distribution response : {}", response);
            }
            if (result.size() > configuration.bufferSize()) {
                //avoid too big foot print
                result.emptyCurrentSet();
            }
            if (configuration.sleep() > 0) {
                log.debug("sleeping for {}ms", configuration.sleep());
                Thread.sleep(configuration.sleep());
            }
        }
    }